linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: net: wireless: ath: ath9k: dfs: remove VLA usage
@ 2018-03-09 13:23 Andreas Christoforou
  2018-03-09 13:29 ` Joe Perches
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andreas Christoforou @ 2018-03-09 13:23 UTC (permalink / raw)
  To: keescook
  Cc: kernel-hardening, Andreas Christoforou, QCA ath9k Development,
	Kalle Valo, linux-wireless, netdev, linux-kernel

The kernel would like to have all stack VLA usage removed.

This is the correct patch.

Signed-off-by: Andreas Christoforou <andreaschristofo@gmail.com>
---
 drivers/net/wireless/ath/ath9k/dfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c
index 6fee9a4..eeb77f2 100644
--- a/drivers/net/wireless/ath/ath9k/dfs.c
+++ b/drivers/net/wireless/ath/ath9k/dfs.c
@@ -101,7 +101,7 @@ static bool ath9k_check_chirping(struct ath_softc *sc, u8 *data,
 				 int datalen, bool is_ctl, bool is_ext)
 {
 	int i;
-	int max_bin[FFT_NUM_SAMPLES];
+	int max_bin[NUM_DIFFS + 1];
 	struct ath_hw *ah = sc->sc_ah;
 	struct ath_common *common = ath9k_hw_common(ah);
 	int prev_delta;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drivers: net: wireless: ath: ath9k: dfs: remove VLA usage
  2018-03-09 13:23 [PATCH] drivers: net: wireless: ath: ath9k: dfs: remove VLA usage Andreas Christoforou
@ 2018-03-09 13:29 ` Joe Perches
  2018-03-09 15:42   ` Rosen Penev
  2018-03-09 13:34 ` Eric Dumazet
  2018-03-09 14:50 ` Kalle Valo
  2 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2018-03-09 13:29 UTC (permalink / raw)
  To: Andreas Christoforou, keescook
  Cc: kernel-hardening, QCA ath9k Development, Kalle Valo,
	linux-wireless, netdev, linux-kernel

On Fri, 2018-03-09 at 15:23 +0200, Andreas Christoforou wrote:
> The kernel would like to have all stack VLA usage removed.
> This is the correct patch.
[]
> diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c
[]
> @@ -101,7 +101,7 @@ static bool ath9k_check_chirping(struct ath_softc *sc, u8 *data,
>  				 int datalen, bool is_ctl, bool is_ext)
>  {
>  	int i;
> -	int max_bin[FFT_NUM_SAMPLES];
> +	int max_bin[NUM_DIFFS + 1];
>  	struct ath_hw *ah = sc->sc_ah;
>  	struct ath_common *common = ath9k_hw_common(ah);
>  	int prev_delta;

why not just change FFT_NUM_SAMPLES to a #define
or get rid if FFT_NUM_SAMPLES altogether?

$ git grep -w FFT_NUM_SAMPLES
drivers/net/wireless/ath/ath9k/dfs.c:static const int FFT_NUM_SAMPLES   = (NUM_DIFFS + 1);
drivers/net/wireless/ath/ath9k/dfs.c:   int max_bin[FFT_NUM_SAMPLES];
drivers/net/wireless/ath/ath9k/dfs.c:           if (num_fft_packets < (FFT_NUM_SAMPLES)) {
drivers/net/wireless/ath/ath9k/dfs.c:           for (i = 0; i < FFT_NUM_SAMPLES; i++)
drivers/net/wireless/ath/ath9k/dfs.c:           if (num_fft_packets < (FFT_NUM_SAMPLES)) {
drivers/net/wireless/ath/ath9k/dfs.c:           for (i = 0; i < FFT_NUM_SAMPLES; i++)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drivers: net: wireless: ath: ath9k: dfs: remove VLA usage
  2018-03-09 13:23 [PATCH] drivers: net: wireless: ath: ath9k: dfs: remove VLA usage Andreas Christoforou
  2018-03-09 13:29 ` Joe Perches
@ 2018-03-09 13:34 ` Eric Dumazet
  2018-03-09 14:50 ` Kalle Valo
  2 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2018-03-09 13:34 UTC (permalink / raw)
  To: Andreas Christoforou, keescook
  Cc: kernel-hardening, QCA ath9k Development, Kalle Valo,
	linux-wireless, netdev, linux-kernel



On 03/09/2018 05:23 AM, Andreas Christoforou wrote:
> The kernel would like to have all stack VLA usage removed.
> 
> This is the correct patch.
> 
> Signed-off-by: Andreas Christoforou <andreaschristofo@gmail.com>

This is a lazy changelog really.

'This is the correct patch' has no technical value.

What is VLA  ? Sure, _now_ its pretty clear since we have floods of 
these patches, but...

In one or two years, people reading it will not understand the logic of 
this patch.

I had to look at the source to understand what was going on, and that is 
not a good sign for a trivial patch like that.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drivers: net: wireless: ath: ath9k: dfs: remove VLA usage
  2018-03-09 13:23 [PATCH] drivers: net: wireless: ath: ath9k: dfs: remove VLA usage Andreas Christoforou
  2018-03-09 13:29 ` Joe Perches
  2018-03-09 13:34 ` Eric Dumazet
@ 2018-03-09 14:50 ` Kalle Valo
  2 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2018-03-09 14:50 UTC (permalink / raw)
  To: Andreas Christoforou
  Cc: keescook, kernel-hardening, QCA ath9k Development,
	linux-wireless, netdev, linux-kernel

Andreas Christoforou <andreaschristofo@gmail.com> writes:

> The kernel would like to have all stack VLA usage removed.
>
> This is the correct patch.
>
> Signed-off-by: Andreas Christoforou <andreaschristofo@gmail.com>

Please use versioning in the patches:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#patch_version_missing

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drivers: net: wireless: ath: ath9k: dfs: remove VLA usage
  2018-03-09 13:29 ` Joe Perches
@ 2018-03-09 15:42   ` Rosen Penev
  0 siblings, 0 replies; 5+ messages in thread
From: Rosen Penev @ 2018-03-09 15:42 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andreas Christoforou, keescook, kernel-hardening,
	QCA ath9k Development, Kalle Valo, linux-wireless, netdev,
	linux-kernel

On Fri, Mar 9, 2018 at 5:29 AM, Joe Perches <joe@perches.com> wrote:
> On Fri, 2018-03-09 at 15:23 +0200, Andreas Christoforou wrote:
>> The kernel would like to have all stack VLA usage removed.
>> This is the correct patch.
> []
>> diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c
> []
>> @@ -101,7 +101,7 @@ static bool ath9k_check_chirping(struct ath_softc *sc, u8 *data,
>>                                int datalen, bool is_ctl, bool is_ext)
>>  {
>>       int i;
>> -     int max_bin[FFT_NUM_SAMPLES];
>> +     int max_bin[NUM_DIFFS + 1];
>>       struct ath_hw *ah = sc->sc_ah;
>>       struct ath_common *common = ath9k_hw_common(ah);
>>       int prev_delta;
>
> why not just change FFT_NUM_SAMPLES to a #define
> or get rid if FFT_NUM_SAMPLES altogether?
>
I did the former yesterday. Never submitted.
> $ git grep -w FFT_NUM_SAMPLES
> drivers/net/wireless/ath/ath9k/dfs.c:static const int FFT_NUM_SAMPLES   = (NUM_DIFFS + 1);
> drivers/net/wireless/ath/ath9k/dfs.c:   int max_bin[FFT_NUM_SAMPLES];
> drivers/net/wireless/ath/ath9k/dfs.c:           if (num_fft_packets < (FFT_NUM_SAMPLES)) {
> drivers/net/wireless/ath/ath9k/dfs.c:           for (i = 0; i < FFT_NUM_SAMPLES; i++)
> drivers/net/wireless/ath/ath9k/dfs.c:           if (num_fft_packets < (FFT_NUM_SAMPLES)) {
> drivers/net/wireless/ath/ath9k/dfs.c:           for (i = 0; i < FFT_NUM_SAMPLES; i++)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-03-09 15:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-09 13:23 [PATCH] drivers: net: wireless: ath: ath9k: dfs: remove VLA usage Andreas Christoforou
2018-03-09 13:29 ` Joe Perches
2018-03-09 15:42   ` Rosen Penev
2018-03-09 13:34 ` Eric Dumazet
2018-03-09 14:50 ` Kalle Valo

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).