LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v3] ath9k: dfs: Remove VLA usage
@ 2018-04-24 23:57 Kees Cook
2018-04-25 7:26 ` Kalle Valo
0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2018-04-24 23:57 UTC (permalink / raw)
To: Kalle Valo
Cc: Andreas Christoforou, Rosen Penev, Eric Dumazet, Joe Perches,
linux-wireless, netdev, QCA ath9k Development, kernel-hardening,
linux-kernel
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 <andreaschristofo@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
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;
--
2.7.4
--
Kees Cook
Pixel Security
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] ath9k: dfs: Remove VLA usage
2018-04-24 23:57 [PATCH v3] ath9k: dfs: Remove VLA usage Kees Cook
@ 2018-04-25 7:26 ` Kalle Valo
2018-04-25 14:42 ` Kees Cook
0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2018-04-25 7:26 UTC (permalink / raw)
To: Kees Cook
Cc: Andreas Christoforou, Rosen Penev, Eric Dumazet, Joe Perches,
linux-wireless, netdev, QCA ath9k Development, kernel-hardening,
linux-kernel
Kees Cook <keescook@chromium.org> writes:
> 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 <andreaschristofo@gmail.com>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> 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)
I have already applied an almost identical patch:
ath9k: dfs: remove accidental use of stack VLA
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=ath-next&id=9c27489a34548913baaaf3b2776e05d4a9389e3e
--
Kalle Valo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] ath9k: dfs: Remove VLA usage
2018-04-25 7:26 ` Kalle Valo
@ 2018-04-25 14:42 ` Kees Cook
0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2018-04-25 14:42 UTC (permalink / raw)
To: Kalle Valo
Cc: Andreas Christoforou, Rosen Penev, Eric Dumazet, Joe Perches,
linux-wireless, Network Development, QCA ath9k Development,
Kernel Hardening, LKML
On Wed, Apr 25, 2018 at 12:26 AM, Kalle Valo <kvalo@codeaurora.org> wrote:
> I have already applied an almost identical patch:
>
> ath9k: dfs: remove accidental use of stack VLA
>
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=ath-next&id=9c27489a34548913baaaf3b2776e05d4a9389e3e
Ah! Cool, no worries. I didn't see that in linux-next yet. :)
Thanks!
-Kees
--
Kees Cook
Pixel Security
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-25 14:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-24 23:57 [PATCH v3] ath9k: dfs: Remove VLA usage Kees Cook
2018-04-25 7:26 ` Kalle Valo
2018-04-25 14:42 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).