From patchwork Sat Mar 10 07:40:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Christoforou X-Patchwork-Id: 10273293 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 86204602BD for ; Sat, 10 Mar 2018 07:47:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BCE629D45 for ; Sat, 10 Mar 2018 07:47:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FB5229D4E; Sat, 10 Mar 2018 07:47: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 A242529D45 for ; Sat, 10 Mar 2018 07:47:01 +0000 (UTC) Received: (qmail 31963 invoked by uid 550); 10 Mar 2018 07:47:00 -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 Received: (qmail 31926 invoked from network); 10 Mar 2018 07:46:59 -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=vp8TB+Wcyvv8moPQGo6/RPcCsEvC3KZjuWDfaKRM9Ak=; b=jmiyP5R1KCsd98paNxiD2JNcqQr9rQlbIawhVKpTMd2cmG6unWNkefW0BqS5vk5w04 MMjhQx/We1O0b6AJq/cutrRUhxK4wcpbXbpqBCAqn0dgU4xeAo8aEa3IyYQfJnJ9eDD/ pWuUktUyiotTy25LRzbGMWvEATyuPwI/MlINxM8Lm7Bk1gewTHtzWURPNpdoNRYVoS1E R59+c74qdoUihdSX/FApbpIq3wBfmy8vNbBL8jwYMZPrVQjMEYk77lB6HvFbit6kmdcR WjXHILmXadARRQNGZTkgLR1N6ndFJJZfnJFdJiD4y5IPyXvfNECvb8RxBj9AY8QFpUJk sQ8g== 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=vp8TB+Wcyvv8moPQGo6/RPcCsEvC3KZjuWDfaKRM9Ak=; b=ScQH4xoCxud2PS8TDR+MZqkMiFQ00vF1Dg49gvof581gOOgjq1iof44R91adpOFIeI GXAtndd+WOIwp/9ClMlM0v2ufZzY/Qc2wrJBzgh8FL+y/ctL6TjGhEHKRMA7qARr0KTQ uMmj+h2fTnQ9AuGAEORt1wyAMzDIlxjDC/VYIX/dyqtBenG1UgJLV1taNzMS0/dVwSAZ cDbwP9mtjkhw7sBW+adZBX+DzwmXvJ2tDF/auGg+Sa/xtHzijKkTNuej74f+JQOzx16C BytS/vmF4ttoBQqZTMjB6xLnY8CsoAlSsNSizRp0eRDd/uwYNCQYRlqzrcLTQAIzYs9t 9tyQ== X-Gm-Message-State: AElRT7FOmObfKoiRHByCke2F6EIQTbTZlXrhrFgdsVuhn+vvHzUhAsK5 cmoYWJlRisZ9LTt0ePzNYOk= X-Google-Smtp-Source: AG47ELuRmHsI3rFW3FCcDMNvphr2Qpfm7+stLI3O7IuvFKep13ClAE1M9TOnG6K47t7Wg0UFqcT3DA== X-Received: by 10.28.165.7 with SMTP id o7mr476075wme.38.1520668008342; Fri, 09 Mar 2018 23:46:48 -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 v2] net: ipv6: xfrm6_state: remove VLA usage Date: Sat, 10 Mar 2018 09:40:44 +0200 Message-Id: <1520667645-21975-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]. 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));