Skip to contentSkip to conversation

ath10k: add support for configuring management packet rate

bug report Dan Carpenter 1 participant 1 message Oct 10, 2018 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

Hello Sriram R,

The patch f279294e9ee2: "ath10k: add support for configuring management packet rate" from Sep 10, 2018, leads to the following static checker warning:

	drivers/net/wireless/ath/ath10k/mac.c:168 ath10k_mac_get_rate_hw_value()
	error: buffer overflow 'ath10k_rates' 12 <= 143

drivers/net/wireless/ath/ath10k/mac.c
159 static int ath10k_mac_get_rate_hw_value(int bitrate) 160 {
161 int i;
162 u8 hw_value_prefix = 0;
163
164 if (ath10k_mac_bitrate_is_cck(bitrate))
165 hw_value_prefix = WMI_RATE_PREAMBLE_CCK << 6;
166

   167          for (i = 0; i < sizeof(ath10k_rates); i++) {
                                ^^^^^^^^^^^^^^^^^^^^

Should be ARRAY_SIZE() instead of sizeof().

   168                  if (ath10k_rates[i].bitrate == bitrate)
   169                          return hw_value_prefix | ath10k_rates[i].hw_value;
   170          }
   171  
   172          return -EINVAL;
   173  }
   174  

regards,
dan carpenter

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k