Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751243AbdCQTW1 (ORCPT ); Fri, 17 Mar 2017 15:22:27 -0400 Received: from mail-it0-f42.google.com ([209.85.214.42]:38212 "EHLO mail-it0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751175AbdCQTWZ (ORCPT ); Fri, 17 Mar 2017 15:22:25 -0400 MIME-Version: 1.0 In-Reply-To: <20170317124404.mt3jd5q5vyk63q2w@hirez.programming.kicks-ass.net> References: <20170317001520.85223-1-md@google.com> <20170317001520.85223-7-md@google.com> <20170317120837.pr74cv3xuj7qpoin@hirez.programming.kicks-ass.net> <20170317124404.mt3jd5q5vyk63q2w@hirez.programming.kicks-ass.net> From: Michael Davidson Date: Fri, 17 Mar 2017 11:52:01 -0700 Message-ID: Subject: Re: [PATCH 6/7] md/raid10, LLVM: get rid of variable length array To: Peter Zijlstra Cc: Alexander Potapenko , Michal Marek , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Herbert Xu , "David S. Miller" , Shaohua Li , Dmitry Vyukov , Matthias Kaehlcke , x86@kernel.org, linux-kbuild@vger.kernel.org, LKML , linux-crypto@vger.kernel.org, linux-raid@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 980 Lines: 23 On Fri, Mar 17, 2017 at 5:44 AM, Peter Zijlstra wrote: > > Be that as it may; what you construct above is disgusting. Surely the > code can be refactored to not look like dog vomit? > > Also; its not immediately obvious conf->copies is 'small' and this > doesn't blow up the stack; I feel that deserves a comment somewhere. > I agree that the code is horrible. It is, in fact, exactly the same solution that was used to remove variable length arrays in structs from several of the crypto drivers a few years ago - see the definition of SHASH_DESC_ON_STACK() in "crypto/hash.h" - I did not, however, hide the horrors in a macro preferring to leave the implementation visible as a warning to whoever might touch the code next. I believe that the actual stack usage is exactly the same as it was previously. I can certainly wrap this up in a macro and add comments with appropriately dire warnings in it if you feel that is both necessary and sufficient.