All of lore.kernel.org
 help / color / mirror / Atom feed
* [ath6kl:pending 39/55] drivers/net/wireless/ath/ath10k/mac.c:169 ath10k_mac_get_rate_hw_value() error: buffer overflow 'ath10k_rates' 12 <= 143
@ 2018-09-22 12:38 Dan Carpenter
  2018-09-24 11:09 ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2018-09-22 12:38 UTC (permalink / raw)
  To: kbuild, Sriram R; +Cc: Kalle Valo, kbuild-all, ath10k

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git pending
head:   2305dc3c6b1d66a7bef752439919d61478e02893
commit: 0c737c78082055ff589f6683e93b45f079c5d64e [39/55] ath10k: Add support for configuring management packet rate

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

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

# https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?id=0c737c78082055ff589f6683e93b45f079c5d64e
git remote add ath6kl https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
git remote update ath6kl
git checkout 0c737c78082055ff589f6683e93b45f079c5d64e
vim +/ath10k_rates +169 drivers/net/wireless/ath/ath10k/mac.c

01cebe1c Michal Kazior 2015-03-30  159  
0c737c78 Sriram R      2018-09-10  160  static int ath10k_mac_get_rate_hw_value(int bitrate)
0c737c78 Sriram R      2018-09-10  161  {
0c737c78 Sriram R      2018-09-10  162  	int i;
0c737c78 Sriram R      2018-09-10  163  	u8 hw_value_prefix = 0;
0c737c78 Sriram R      2018-09-10  164  
0c737c78 Sriram R      2018-09-10  165  	if (ath10k_mac_bitrate_is_cck(bitrate))
0c737c78 Sriram R      2018-09-10  166  		hw_value_prefix = WMI_RATE_PREAMBLE_CCK << 6;
0c737c78 Sriram R      2018-09-10  167  
0c737c78 Sriram R      2018-09-10  168  	for (i = 0; i < sizeof(ath10k_rates); i++) {
                                                                ^^^^^^^^^^^^^^^^^^^^
This should be ARRAY_SIZE(ath10k_rates) instead of sizeof().

0c737c78 Sriram R      2018-09-10 @169  		if (ath10k_rates[i].bitrate == bitrate)
0c737c78 Sriram R      2018-09-10  170  			return hw_value_prefix | ath10k_rates[i].hw_value;
0c737c78 Sriram R      2018-09-10  171  	}
0c737c78 Sriram R      2018-09-10  172  
0c737c78 Sriram R      2018-09-10  173  	return -EINVAL;
0c737c78 Sriram R      2018-09-10  174  }
0c737c78 Sriram R      2018-09-10  175  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

end of thread, other threads:[~2018-09-25  5:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-22 12:38 [ath6kl:pending 39/55] drivers/net/wireless/ath/ath10k/mac.c:169 ath10k_mac_get_rate_hw_value() error: buffer overflow 'ath10k_rates' 12 <= 143 Dan Carpenter
2018-09-24 11:09 ` Kalle Valo
2018-09-25  5:50   ` Sriram R

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.