From patchwork Fri Mar 9 12:21:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Christoforou X-Patchwork-Id: 10270535 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4D15960594 for ; Fri, 9 Mar 2018 12:39:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FC2928C6D for ; Fri, 9 Mar 2018 12:39:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43D4129DB5; Fri, 9 Mar 2018 12:39:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 804E728C6D for ; Fri, 9 Mar 2018 12:39:02 +0000 (UTC) Received: (qmail 5968 invoked by uid 550); 9 Mar 2018 12:38:54 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Delivered-To: moderator for kernel-hardening@lists.openwall.com Received: (qmail 22514 invoked from network); 9 Mar 2018 12:22:19 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=PpJhd5F9hEY2ZzbN4hddMxG0w/j6Geg+LH0C6ryn7ME=; b=eXjFKSt928lLyBj1bRd07CcGgyq2O21EUmDgVG+8bylbcYTdqNJksMVV0KF6puXDZu aLDOctJgFc84uggWxPV+ftS1ruT67VdklYlzSPsXJaV1S6nSzedHgptuVcL8mwRatcEv WeWELs4esxwhRyGF/B/QEZ/+y4/+B1TMZHzb0TENYI8mtPOY7buwHD9Kku7Bty8nfwNS M3j6K4HvvXkgjLXEceEOUUiTJOSmT/4zUSQZAGTZ/WMr4EAgW/OPjjZ3zc6IIFtDzFh0 rItaH0JvqPQ0cMbgA8eE2O7D2+f0/LgXN3CyNn+ND760CluBNq5fNzlliD9RTUDsz/Fj n6lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PpJhd5F9hEY2ZzbN4hddMxG0w/j6Geg+LH0C6ryn7ME=; b=rpN9LcAS5Tny1AkfdgovWeCgsc4rL8hQAR7QK//g6fFisLDSFUHsURTtC2MQ2vJ1dp XLQpcmE2/Tp+DIgujyMf6+w2uEEZJ3H7vX0FEGGcpC8s5mqI7pk6jZ8LISX3jly8BA+Q pPN+gMlkIvAF20yKXDmmlFkOxzwkHhbHP/z7gST3Ub5NsMUUZAd0BsHCKdVG3rfNuoc3 myEiWUJBVtx7HLsU+2FwL4VusF5T41FwLxBpSSZmMOH+hY9f8FkJ0CTZmo5RPgS6q2DH shU/JcjmI429e3zmLGJ54gSAP2XFjG0L9Dlni+aMLqi6DWKFhTyYU9RBGq/l53A9Qux6 mr/Q== X-Gm-Message-State: APf1xPAWStecX/LKZUB68ZHsN1zjU2jhRc4PGM1z1PK0xCozX6gQe0NY IQ2BTapRDknATWJ/PmfxBpE= X-Google-Smtp-Source: AG47ELuR5PqnyOv/4AZIxBA6qEMgjs0N5MJzYXzlfNgQ6UCYYdN58Lhx8wAmi4zLvKWfvZKv+MRrDA== X-Received: by 10.223.224.199 with SMTP id e7mr23975383wri.263.1520598128007; Fri, 09 Mar 2018 04:22:08 -0800 (PST) From: Andreas Christoforou To: keescook@chromium.org Cc: kernel-hardening@lists.openwall.com, Andreas Christoforou , Steffen Klassert , Herbert Xu , "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: ipv6: xfrm6_state: remove VLA usage Date: Fri, 9 Mar 2018 14:21:46 +0200 Message-Id: <1520598106-3271-1-git-send-email-andreaschristofo@gmail.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP The kernel would like to have all stack VLA usage removed[1]. Signed-off-by: Andreas Christoforou --- net/ipv6/xfrm6_state.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c index b15075a..45c0d98 100644 --- a/net/ipv6/xfrm6_state.c +++ b/net/ipv6/xfrm6_state.c @@ -62,7 +62,12 @@ __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; + + count = kcalloc(maxclass + 1, sizeof(*count), GFP_KERNEL); + + if (!count) + return -ENOMEM; memset(count, 0, sizeof(count)); @@ -80,6 +85,7 @@ __xfrm6_sort(void **dst, void **src, int n, int (*cmp)(void *p), int maxclass) src[i] = NULL; } + kfree(count); return 0; }