Skip to contentSkip to conversation

staging: r8723au: Add missing initialization of change_inx in sort algorithm

PATCH In review Geert Uytterhoeven 2 participants 3 messages Apr 10, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: r8723au: Add missing initialization of change_inx in sort algorithm

drivers/staging/rtl8723au/core/rtw_wlan_util.c: In function ‘WMMOnAssocRsp23a’:
drivers/staging/rtl8723au/core/rtw_wlan_util.c:684: warning: ‘change_inx’ may be used uninitialized in this function

Depending on the uninitialized data on the stack, the array may not be sorted correctly.

---
 drivers/staging/rtl8723au/core/rtw_wlan_util.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723au/core/rtw_wlan_util.c +1 -1
index 0dfcfbce3b52..a4361bb93865 100644
@@ -681,7 +681,7 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter)
 	inx[0] = 0; inx[1] = 1; inx[2] = 2; inx[3] = 3;
 
 	if (pregpriv->wifi_spec == 1) {
-		u32	j, tmp, change_inx;
+		u32	j, tmp, change_inx = false;
 
 		/* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */
 		for (i = 0; i < 4; i++) {
Signature · 1 line
1.7.9.5
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Geert Uytterhoeven

drivers/staging/rtl8723au/core/rtw_wlan_util.c: In function ‘WMMOnAssocRsp23a’:
drivers/staging/rtl8723au/core/rtw_wlan_util.c:684: warning: ‘change_inx’ may be used uninitialized in this function

Depending on the uninitialized data on the stack, the array may not be sorted correctly.

---

Geert,

Thanks for this. I wonder why my gcc on x86_64 did not flag this problem.

Larry

Quoted 17 lines
  drivers/staging/rtl8723au/core/rtw_wlan_util.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723au/core/rtw_wlan_util.c +1 -1
index 0dfcfbce3b52..a4361bb93865 100644
@@ -681,7 +681,7 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter)
  	inx[0] = 0; inx[1] = 1; inx[2] = 2; inx[3] = 3;
 
  	if (pregpriv->wifi_spec == 1) {
-		u32	j, tmp, change_inx;
+		u32	j, tmp, change_inx = false;
 
  		/* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */
  		for (i = 0; i < 4; i++) {
#2 lore raw

Hi Larry,

Quoted 10 lines · Larry Finger
Quoted 9 lines · Geert Uytterhoeven

drivers/staging/rtl8723au/core/rtw_wlan_util.c: In function ‘WMMOnAssocRsp23a’:
drivers/staging/rtl8723au/core/rtw_wlan_util.c:684: warning: ‘change_inx’ may be used uninitialized in this function

Depending on the uninitialized data on the stack, the array may not be sorted correctly.

Quoted 8 lines
Quoted 2 lines

---

Geert,

Thanks for this. I wonder why my gcc on x86_64 did not flag this problem.

Because it's too new?

Several warnings were disabled in more recent versions of gcc (still using 4.1.2 for m68k here ;-) due to too many false positives.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds