2012-11-26 21:03:52

by Dan Carpenter

[permalink] [raw]
Subject: re: ath9k: Add concurrent WLAN and BT tx support for MCI based chips

Hello Rajkumar Manoharan,

The patch db60428b1af1: "ath9k: Add concurrent WLAN and BT tx support
for MCI based chips" from Oct 12, 2012, leads to the following
warning:
drivers/net/wireless/ath/ath9k/btcoex.c:414
ath9k_hw_btcoex_set_concur_txprio()
error: buffer overflow 'stomp_txprio' 4 <= 4

stomp_txprio has 4 elements.
u8 stomp_txprio[] = { 0, 0, 0, 0 }; /* all, low, none, low_ftp */

drivers/net/wireless/ath/ath9k/btcoex.c
408 void ath9k_hw_btcoex_set_concur_txprio(struct ath_hw *ah, u8 *stomp_txprio)
409 {
410 struct ath_btcoex_hw *btcoex = &ah->btcoex_hw;
411 int i;
412
413 for (i = 0; i < ATH_BTCOEX_STOMP_MAX; i++)
^^^^^^^^^^^^^^^^^^^^
This is 5.

414 btcoex->tx_prio[i] = stomp_txprio[i];
^^^^^^^^^^^^^^
We are reading one positition past the end of the array.

415 }

Possibly we need to add some code to handle ATH_BTCOEX_STOMP_AUDIO which
was added recently in 2884561a "ath9k: stomp audio profiles on weak
signal strength."

regards,
dan carpenter



2012-11-27 08:28:26

by Rajkumar Manoharan

[permalink] [raw]
Subject: Re: ath9k: Add concurrent WLAN and BT tx support for MCI based chips

On Tue, Nov 27, 2012 at 12:03:37AM +0300, Dan Carpenter wrote:
> Hello Rajkumar Manoharan,
>
> The patch db60428b1af1: "ath9k: Add concurrent WLAN and BT tx support
> for MCI based chips" from Oct 12, 2012, leads to the following
> warning:
> drivers/net/wireless/ath/ath9k/btcoex.c:414
> ath9k_hw_btcoex_set_concur_txprio()
> error: buffer overflow 'stomp_txprio' 4 <= 4
>
Dan,

Thanks a lot. Is there a way to enable all checks while building smatch tool?

-Rajkumar

2012-11-27 08:49:23

by Dan Carpenter

[permalink] [raw]
Subject: Re: ath9k: Add concurrent WLAN and BT tx support for MCI based chips

On Tue, Nov 27, 2012 at 01:58:35PM +0530, Rajkumar Manoharan wrote:
> On Tue, Nov 27, 2012 at 12:03:37AM +0300, Dan Carpenter wrote:
> > Hello Rajkumar Manoharan,
> >
> > The patch db60428b1af1: "ath9k: Add concurrent WLAN and BT tx support
> > for MCI based chips" from Oct 12, 2012, leads to the following
> > warning:
> > drivers/net/wireless/ath/ath9k/btcoex.c:414
> > ath9k_hw_btcoex_set_concur_txprio()
> > error: buffer overflow 'stomp_txprio' 4 <= 4
> >
> Dan,
>
> Thanks a lot. Is there a way to enable all checks while building smatch tool?
>

This one requires the sqlite database to get the cross function
info. It's a two compile process, the first builds the db and the
next does the test. Replace the path names as appropriate:

~/progs/smatch/devel/smatch_scripts/build_kernel_data.sh
~/progs/smatch/devel/smatch_scripts/test_kernel.sh

regards,
dan carpenter