From patchwork Tue Apr 24 23:57:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10361309 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 8520F602A0 for ; Tue, 24 Apr 2018 23:58:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7202A28E8F for ; Tue, 24 Apr 2018 23:58:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64C3C28E98; Tue, 24 Apr 2018 23:58:11 +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=-5.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, 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 9317428E8F for ; Tue, 24 Apr 2018 23:58:10 +0000 (UTC) Received: (qmail 13656 invoked by uid 550); 24 Apr 2018 23:58:08 -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 13581 invoked from network); 24 Apr 2018 23:58:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=P4OR2bs8LOOyKBUaIeannur0COHiKggc9aW5OIwEC7U=; b=E+MD8UJMZuGfZczQvJ5MKxA4ytUAbt7kVGStnkIsUcE3+mRnvgLBkOO0DSXqNyb969 8bGe8hIvOJFxGxzeLz/kfljMGT4EnHUj2ZVcKXSjzQJdZGFiq5mvJ+ieaJilRQgJRFkE HIbkYshDv+1zZQDzEBmxRO2b5XXZiG9S2JQRw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=P4OR2bs8LOOyKBUaIeannur0COHiKggc9aW5OIwEC7U=; b=hRejK1u14QlJC4DGHk+itFOMGX9OTVchLGymVnis2x88siMgjhI2tfGXyiCmAJlZDJ pvfdb24RVMCwI7LxOxSKZLakxsXlr7AkjHxcKB0huij3eIDbZYtQ5Zwoz5JtOvSWHk5c jCAinw0cz8pXei0l1w/S4QIUC2M+bQM2kyNp91jCW5O7Fv9fkazIBlsZ0z6K5YY+h5FF r9kib6BKYDDToc/PEnHfi8lxfJOFESchjJ8RbaHaq3b2SdMLwogp4zdfCOCYAvvuxYr6 GOVN1XHk3lDFRraX7KpvvC4IRAc5h50FrMUnT5seni3JOQ3NpW5ZXt01DL74NPieobXY 7FvA== X-Gm-Message-State: ALQs6tC/w2r6mzlS42uZOH9ga8VMRep85IEMAIlmDRHW/INCoQXNbGz1 0bbE5WFMrtup1i8aCEjkiTaDwg== X-Google-Smtp-Source: AIpwx4/UWulCtoljc6HIHXTkLtQvXx9HDu+NeynmJWx2+XdrQP1vADObO3sXpOBUcVDr3M+1/WxRbQ== X-Received: by 2002:a17:902:820a:: with SMTP id x10-v6mr26581276pln.203.1524614275512; Tue, 24 Apr 2018 16:57:55 -0700 (PDT) Date: Tue, 24 Apr 2018 16:57:52 -0700 From: Kees Cook To: Kalle Valo Cc: Andreas Christoforou , Rosen Penev , Eric Dumazet , Joe Perches , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, QCA ath9k Development , kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org Subject: [PATCH v3] ath9k: dfs: Remove VLA usage Message-ID: <20180424235752.GA37317@beast> MIME-Version: 1.0 Content-Disposition: inline X-Virus-Scanned: ClamAV using ClamSMTP In the quest to remove all stack VLA usage from the kernel[1], this redefines FFT_NUM_SAMPLES as a #define instead of const int, which still triggers gcc's VLA checking pass. [1] https://lkml.org/lkml/2018/3/7/621 Co-developed-by: Andreas Christoforou Signed-off-by: Kees Cook --- v3: replace FFT_NUM_SAMPLES as a #define (Joe) --- drivers/net/wireless/ath/ath9k/dfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c index 6fee9a464cce..e6e56a925121 100644 --- a/drivers/net/wireless/ath/ath9k/dfs.c +++ b/drivers/net/wireless/ath/ath9k/dfs.c @@ -40,8 +40,8 @@ static const int BIN_DELTA_MIN = 1; static const int BIN_DELTA_MAX = 10; /* we need at least 3 deltas / 4 samples for a reliable chirp detection */ -#define NUM_DIFFS 3 -static const int FFT_NUM_SAMPLES = (NUM_DIFFS + 1); +#define NUM_DIFFS 3 +#define FFT_NUM_SAMPLES (NUM_DIFFS + 1) /* Threshold for difference of delta peaks */ static const int MAX_DIFF = 2;