Received: by 10.223.185.111 with SMTP id b44csp1179691wrg; Fri, 9 Mar 2018 23:47:57 -0800 (PST) X-Google-Smtp-Source: AG47ELt8dyPtjHNYiIOxlvfpW2rsvgC5DkauFEOyuePPgUbU+8/xwOVPMSY4t6eLmDSlKlXavakx X-Received: by 10.98.69.196 with SMTP id n65mr1269492pfi.29.1520668076996; Fri, 09 Mar 2018 23:47:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520668076; cv=none; d=google.com; s=arc-20160816; b=eMHN3zKA+CdztwqqDUsN6pvf8TDdrgbuwcvmOhik/S9YC6mMDfcSy1zjqg7c3CqXcQ 0ZH9pmIPAK8b840Ij+HEdXIKByRu8s9pA9/RKNQIsaVt/b+tp9+fofZEl8jE0ULTRp5L 5RBO5u/zcaqihMbPx2uJv9NCH7FcdArUJiavWl72usHnXLJf1w/CrGmwH6ml5hylmm3g WgxgwVzVdhvH3xf8ypc9ndLJyYTQa3xZIfplRap84+R+LKZyf/IjTPERXOMGoXoiEN+d 2+OeXe4/sLlynBvdrP0r9Ens0zwqYbjSuKu+e+lrrzU4vtJZy54kZtLAIvfyaJ9pUorg jjAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=vp8TB+Wcyvv8moPQGo6/RPcCsEvC3KZjuWDfaKRM9Ak=; b=RkSvRn5jrTz0bpAI34ieraTvFD7isxW3WXdWyABUiLXIOXQJBjRrB8AuIthGETDGJT kW4idExu8hF/rDJZX478iqqzObUEOAuZ2AbPsfQvorliYqb7ubfSkye/gpYCikQchwUe sLh1r/cqrvVm4Y102Qb+78OgUU6uk3fTRdy5mpdtyEVvkPJI2qMEH99QapgsEXdoePtx 1Bt887TzBNonWp5pszPGEftDtwHjumvYggYVnRKt6kHTJmROafjkVpHPL6vWhqca39RN mY/gKdkL6oun9C2ZHRek/qY34tzgB/hIy891cAhr2ZRCnE0nA1tpGYMG5ghmcg8OE9/s KbCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jmiyP5R1; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u16-v6si2313168plq.183.2018.03.09.23.47.42; Fri, 09 Mar 2018 23:47:56 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jmiyP5R1; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751893AbeCJHqv (ORCPT + 99 others); Sat, 10 Mar 2018 02:46:51 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34558 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750858AbeCJHqt (ORCPT ); Sat, 10 Mar 2018 02:46:49 -0500 Received: by mail-wm0-f68.google.com with SMTP id a20so6236997wmd.1; Fri, 09 Mar 2018 23:46:48 -0800 (PST) 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=l+o9rF97jr9T7Pt0VrU9u5tQ3TtjArwmF6rFMxkhPQxiDn2nN86doLhLq5rVCRK2FT 7cgqRCOD0ROg36NUvXSztP0rdabm5huPRp13GUnLx/hxlFqFriHV56LgxOXVL4wsIIkh 6hAhFKkJh6y2OffA+nWoELgWxK1SBN2NNSrA/FiXJxoFMPsKDBL/1itvSxHY60oQlrmE ETyq+El1NR8chFyVr9gGY3QnWSNtPWEe6nr0rRdvquqOpjrFKCyKzYOd1+kTAhgtVkbs 5YXdsv+l8p8FkYpU589ktKvGHQAVoSF+zHlLFPip/Etdw167c4/ISI0iLN0JytkjNDlk 782w== X-Gm-Message-State: AElRT7ExfCK2JmRy3fkjihRI3+ggysvZ3ixfr7Ey7Dg0cQvGxdczLLSl E8sd1rmkxNoYJyoY7t/63Gg= X-Received: by 10.28.165.7 with SMTP id o7mr476075wme.38.1520668008342; Fri, 09 Mar 2018 23:46:48 -0800 (PST) Received: from localhost.localdomain ([213.140.203.51]) by smtp.googlemail.com with ESMTPSA id h50sm4949421wrf.65.2018.03.09.23.46.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 23:46:47 -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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)); -- 2.7.4