Skip to contentSkip to conversation

drivers: net: wireless: ath: ath9k: dfs: remove VLA usage

PATCH In review Andreas Christoforou 5 participants 5 messages Mar 9, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: net: wireless: ath: ath9k: dfs: remove VLA usage

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

This is the correct patch.

---
 drivers/net/wireless/ath/ath9k/dfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/dfs.c +1 -1
index 6fee9a4..eeb77f2 100644
@@ -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;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 2 lines · Andreas Christoforou

The kernel would like to have all stack VLA usage removed. This is the correct patch.

[]

drivers/net/wireless/ath/ath9k/dfs.c

Quoted 1 line
drivers/net/wireless/ath/ath9k/dfs.c +0 -0

[]

drivers/net/wireless/ath/ath9k/dfs.c static bool ath9k_check_chirping(struct ath_softc *sc, u8 *data, · line 107

Quoted 9 lines
drivers/net/wireless/ath/ath9k/dfs.c +1 -1
@@ -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++)
#3 lore raw
In reply to Andreas Christoforou
Quoted 5 lines · Andreas Christoforou

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

This is the correct patch.

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.

#2 lore raw
In reply to Joe Perches
Quoted 6 lines · Joe Perches
Quoted 2 lines · Andreas Christoforou

The kernel would like to have all stack VLA usage removed. This is the correct patch.

[]

drivers/net/wireless/ath/ath9k/dfs.c

Quoted 1 line
drivers/net/wireless/ath/ath9k/dfs.c +0 -0

[]

Quoted 13 lines

drivers/net/wireless/ath/ath9k/dfs.c static bool ath9k_check_chirping(struct ath_softc *sc, u8 *data, · line 107

Quoted 9 lines
drivers/net/wireless/ath/ath9k/dfs.c +1 -1
@@ -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.

Quoted 7 lines
$ 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++)