mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: r8188eu: Fix uninitialized variable change_inx
@ 2013-09-06 12:45 Geert Uytterhoeven
  2013-09-06 14:42 ` Larry Finger
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2013-09-06 12:45 UTC (permalink / raw)
  To: Larry Finger, Greg Kroah-Hartman; +Cc: devel, linux-kernel, Geert Uytterhoeven

drivers/staging/rtl8188eu/core/rtw_wlan_util.c: In function ‘WMMOnAssocRsp’:
drivers/staging/rtl8188eu/core/rtw_wlan_util.c:634: warning: ‘change_inx’ may be used uninitialized in this function

And the compiler is right: change_inx should be initialized to false.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 013ea48..8018edd 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -631,7 +631,7 @@ void WMMOnAssocRsp(struct 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++) {
-- 
1.7.9.5


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

* Re: [PATCH] staging: r8188eu: Fix uninitialized variable change_inx
  2013-09-06 12:45 [PATCH] staging: r8188eu: Fix uninitialized variable change_inx Geert Uytterhoeven
@ 2013-09-06 14:42 ` Larry Finger
  2013-09-06 14:52   ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: Larry Finger @ 2013-09-06 14:42 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Greg Kroah-Hartman, devel, linux-kernel

On 09/06/2013 07:45 AM, Geert Uytterhoeven wrote:
> drivers/staging/rtl8188eu/core/rtw_wlan_util.c: In function ‘WMMOnAssocRsp’:
> drivers/staging/rtl8188eu/core/rtw_wlan_util.c:634: warning: ‘change_inx’ may be used uninitialized in this function
>
> And the compiler is right: change_inx should be initialized to false.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
>   drivers/staging/rtl8188eu/core/rtw_wlan_util.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
> index 013ea48..8018edd 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
> @@ -631,7 +631,7 @@ void WMMOnAssocRsp(struct 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++) {
>

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

This warning has not shown up on my x86_64 system with gcc 4.7.2. What 
architecture and gcc version were you using?

Thanks,

Larry


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

* Re: [PATCH] staging: r8188eu: Fix uninitialized variable change_inx
  2013-09-06 14:42 ` Larry Finger
@ 2013-09-06 14:52   ` Geert Uytterhoeven
  0 siblings, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2013-09-06 14:52 UTC (permalink / raw)
  To: Larry Finger; +Cc: Greg Kroah-Hartman, driverdevel, linux-kernel

On Fri, Sep 6, 2013 at 4:42 PM, Larry Finger <Larry.Finger@lwfinger.net> wrote:
> On 09/06/2013 07:45 AM, Geert Uytterhoeven wrote:
>> drivers/staging/rtl8188eu/core/rtw_wlan_util.c: In function
>> ‘WMMOnAssocRsp’:
>> drivers/staging/rtl8188eu/core/rtw_wlan_util.c:634: warning: ‘change_inx’
>> may be used uninitialized in this function
>>
>> And the compiler is right: change_inx should be initialized to false.
>>
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>> ---
>>   drivers/staging/rtl8188eu/core/rtw_wlan_util.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
>> b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
>> index 013ea48..8018edd 100644
>> --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
>> +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
>> @@ -631,7 +631,7 @@ void WMMOnAssocRsp(struct 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++) {
>>
>
> Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
>
> This warning has not shown up on my x86_64 system with gcc 4.7.2. What
> architecture and gcc version were you using?

Good old gcc version 4.1.2 20061115 (prerelease) (Ubuntu 4.1.1-21) for m68k.

Recent versions of gcc no longer give warnings for uninitialized variables,
probably because it used to flood you with too many false positives.
This may please the -Werror camp, but once in a while the warnings do disclose
real bugs, so I tend to look at all regressions I encounter there.

I've just checked with m68k-linux-gcc 4.6.3 from crosstool on kernel.org, and
it doesn't give this warning (hmm, it does give other warnings, so I should have
a closer look...).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

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

end of thread, other threads:[~2013-09-06 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-06 12:45 [PATCH] staging: r8188eu: Fix uninitialized variable change_inx Geert Uytterhoeven
2013-09-06 14:42 ` Larry Finger
2013-09-06 14:52   ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®