Skip to contentSkip to conversation

ath6kl: move ath6kl_wmi_startscan_cmd()

DISCUSSION Dan Carpenter 2 participants 4 messages Nov 27, 2012 – Mar 10, 2013

lore
Share & tools
lore
#0 lore raw

Hello Kalle Valo,

The patch c8c72b74e289: "ath6kl: move ath6kl_wmi_startscan_cmd()" from Jul 19, 2012, leads to the following warning:
drivers/net/wireless/ath/ath6kl/wmi.c:2016 ath6kl_wmi_beginscan_cmd()

	 error: buffer overflow 'sc->supp_rates' 2 <= 2

drivers/net/wireless/ath/ath6kl/wmi.c

  2009          for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
                                      ^^^^^^^^^^^^^^^^^^^

This is 3.

  2010                  sband = ar->wiphy->bands[band];
  2011  
  2012                  if (!sband)
  2013                          continue;
  2014  
  2015                  ratemask = rates[band];
  2016                  supp_rates = sc->supp_rates[band].rates;

->supp_rates has only ATH6KL_NUM_BANDS (2) elements so we are reading one element beyond the end.

  2017                  num_rates = 0;

regards,
dan carpenter

#1 lore raw

Whatever happened with this?

regards,
dan carpenter

Quoted 28 lines · Dan Carpenter

Hello Kalle Valo,

The patch c8c72b74e289: "ath6kl: move ath6kl_wmi_startscan_cmd()" from Jul 19, 2012, leads to the following warning:
drivers/net/wireless/ath/ath6kl/wmi.c:2016 ath6kl_wmi_beginscan_cmd()

	 error: buffer overflow 'sc->supp_rates' 2 <= 2

drivers/net/wireless/ath/ath6kl/wmi.c

  2009          for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
                                      ^^^^^^^^^^^^^^^^^^^

This is 3.

  2010                  sband = ar->wiphy->bands[band];
  2011  
  2012                  if (!sband)
  2013                          continue;
  2014  
  2015                  ratemask = rates[band];
  2016                  supp_rates = sc->supp_rates[band].rates;

->supp_rates has only ATH6KL_NUM_BANDS (2) elements so we are reading one element beyond the end.

  2017                  num_rates = 0;

regards,
dan carpenter

#2 lore raw
Quoted 1 line · Dan Carpenter

Whatever happened with this?

It got buried inside my todo folder, sorry about that. I will look at it soon.

Signature · 1 line
Kalle Valo
#3 lore raw
In reply to Dan Carpenter
Quoted 19 lines · Dan Carpenter

The patch c8c72b74e289: "ath6kl: move ath6kl_wmi_startscan_cmd()" from Jul 19, 2012, leads to the following warning:
drivers/net/wireless/ath/ath6kl/wmi.c:2016 ath6kl_wmi_beginscan_cmd()

	 error: buffer overflow 'sc->supp_rates' 2 <= 2

drivers/net/wireless/ath/ath6kl/wmi.c

  2009          for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
                                      ^^^^^^^^^^^^^^^^^^^

This is 3.

  2010                  sband = ar->wiphy->bands[band];
  2011  
  2012                  if (!sband)
  2013                          continue;
  2014  
  2015                  ratemask = rates[band];
  2016                  supp_rates = sc->supp_rates[band].rates;
Quoted 2 lines

->supp_rates has only ATH6KL_NUM_BANDS (2) elements so we are reading one element beyond the end.

This shouldn't happen as only the first two bands are set in ar->wiphy->bands so the 'if (!sband)' will cover rest of the bands. But I want to be careful and I sent a patch which adds an extra check there.

Signature · 1 line
Kalle Valo