Received: by 10.192.165.156 with SMTP id m28csp1155573imm; Mon, 16 Apr 2018 15:15:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+tJjS3ZDw9lN8Ft+PxvIABjtbLHrggvTKi1pw7a2uqPTzQ1vOqWcPAY5+K4KxqE04e+3Th X-Received: by 10.98.166.14 with SMTP id t14mr23362993pfe.195.1523916922535; Mon, 16 Apr 2018 15:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523916922; cv=none; d=google.com; s=arc-20160816; b=doB1B0HHdQifLGd5ownRLuG/8S3Cj+05lplWhvYtDGdklmGAtDomtnUSUbJCCysoQ3 2MquM/mgJOOdg/80OerY/JRgkxKSMgv90SCsqasHA7RUr+Lc7Jm8QKIANKKAFfiNhmEz l97m+SJpNyt9exwIyKGwldXcTFCsKCM55D9SVsZI8HHh4OctJUJ7H92Lv29dmi9Wp0ch rAY+W4MG8kmAY9UPPFNIKBn0r+JIb6l0sLlEXXWYPygZGHu04iUEDjzmuzDBFMkzq7sb eF4R3YU8LfTQKGf/zfdht1UeKfl/VTQsZk524HFJdUBc3BM+wQEMzmk8pWqZ41ELz2nQ K3sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=llKrn4HPwqtbssHYqK96FBWRjaXk83XIWScR+hn/JeY=; b=ql+ELdrhekMrSodu8A3xHFTedcplDXBtOFlHfMDwtx0AzGqtLID0SpQfEuLRPlF3Qs AghCaANnImH3r0EFxCTudjbM3PPVNJg4m7m8EYjkW3VR2FSP31yO2wLe1Zev7riZQBNP RYFvrLGJFlW9f5jr/A53C7s01LbBcVwNJ2FCBVpieZcSG/2cdoY3KyJe/sq/DmWvO9if qBg27swEoQWC/NjNUn+GeQ8H7iMr5mEtzHiMiBxragotZnh6C8Pb8/P8n06LfCxR+FI0 6PYjXbWEJB7+mIEYrGd/Dlypi3zyyuOqiQXJOiEqrrwDb4zK2SIIAHbGfTxodQXxN1iI girA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k64si11673555pfj.262.2018.04.16.15.15.08; Mon, 16 Apr 2018 15:15:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752844AbeDPWN6 (ORCPT + 99 others); Mon, 16 Apr 2018 18:13:58 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50408 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752597AbeDPWN4 (ORCPT ); Mon, 16 Apr 2018 18:13:56 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47584407246E; Mon, 16 Apr 2018 22:13:56 +0000 (UTC) Received: from epycfail (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C6E18215CDC8; Mon, 16 Apr 2018 22:13:52 +0000 (UTC) Date: Tue, 17 Apr 2018 00:13:48 +0200 From: Stefano Brivio To: Andreas Christoforou Cc: keescook@chromium.org, kernel-hardening@lists.openwall.com, Steffen Klassert , Herbert Xu , "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] net: ipv6: xfrm6_state: remove VLA usage Message-ID: <20180417001348.5a2df7c7@epycfail> In-Reply-To: <1520667645-21975-1-git-send-email-andreaschristofo@gmail.com> References: <1520667645-21975-1-git-send-email-andreaschristofo@gmail.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 16 Apr 2018 22:13:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 16 Apr 2018 22:13:56 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'sbrivio@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andreas, On Sat, 10 Mar 2018 09:40:44 +0200 Andreas Christoforou wrote: > The kernel would like to have all stack VLA usage removed[1]. > Instead of dynamic allocation, just use XFRM_MAX_DEPTH > as already done for the "class" array, but as per feedback, > I will not drop maxclass because that changes the behavior. > In one case, it'll do this loop up to 5, the other > caller up to 6. > > [1] https://lkml.org/lkml/2018/3/7/621 > > Signed-off-by: Andreas Christoforou > --- > v2: > - use XFRM_MAX_DEPTH for "count" array (Steffen and Mathias). > --- > net/ipv6/xfrm6_state.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c > index b15075a..270a53a 100644 > --- a/net/ipv6/xfrm6_state.c > +++ b/net/ipv6/xfrm6_state.c > @@ -62,7 +62,7 @@ __xfrm6_sort(void **dst, void **src, int n, int (*cmp)(void *p), int maxclass) > { > int i; > int class[XFRM_MAX_DEPTH]; > - int count[maxclass]; > + int count[XFRM_MAX_DEPTH]; > > memset(count, 0, sizeof(count)); > I hope this didn't get too confusing. In the end, the change I proposed for this patch was simply to drop the memset and initialize 'count' like: int count[XFRM_MAX_DEPTH] = { }; and perhaps, while at it, move this before 'int i', for coding style reasons. When you re-post, please also take care of Steffen's comment. He proposed to change the subject to: xfrm: remove VLA usage in __xfrm6_sort() Note that you should give an indication of which tree this patch should be applied to, by including this in the subject. The current subject doesn't specify it, it should have been: [PATCH v2 ipsec-next] ... Please see Documentation/networking/netdev-FAQ.txt for the difference between net and net-next, as the same distinction applies for ipsec and ipsec-next trees. Thanks. -- Stefano