2023-07-11 17:36:16

by Simon Horman

[permalink] [raw]
Subject: Re: [PATCH net] wifi: airo: avoid uninitialized warning in airo_get_rate()

On Sun, Jul 09, 2023 at 06:31:54AM -0700, Randy Dunlap wrote:
> Quieten a gcc (11.3.0) build error or warning by checking the function
> call status and returning -EBUSY if the function call failed.
> This is similar to what several other wireless drivers do for the
> SIOCGIWRATE ioctl call when there is a locking problem.
>
> drivers/net/wireless/cisco/airo.c: error: 'status_rid.currentXmitRate' is used uninitialized [-Werror=uninitialized]

Hi Randy,

There seem to be other calls to readStatusRid() in the same file
with similar properties. Perhaps it would be best to fix them too?

> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Randy Dunlap <[email protected]>
> Reported-by: Geert Uytterhoeven <[email protected]>
> Link: lore.kernel.org/r/[email protected]
> Cc: Kalle Valo <[email protected]>
> Cc: [email protected]
> Cc: "David S. Miller" <[email protected]>
> Cc: Eric Dumazet <[email protected]>
> Cc: Jakub Kicinski <[email protected]>
> Cc: Paolo Abeni <[email protected]>
> Cc: [email protected]
> ---
> drivers/net/wireless/cisco/airo.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff -- a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c
> --- a/drivers/net/wireless/cisco/airo.c
> +++ b/drivers/net/wireless/cisco/airo.c
> @@ -6157,8 +6157,11 @@ static int airo_get_rate(struct net_devi
> struct iw_param *vwrq = &wrqu->bitrate;
> struct airo_info *local = dev->ml_priv;
> StatusRid status_rid; /* Card status info */
> + int ret;
>
> - readStatusRid(local, &status_rid, 1);
> + ret = readStatusRid(local, &status_rid, 1);
> + if (ret)
> + return -EBUSY;
>
> vwrq->value = le16_to_cpu(status_rid.currentXmitRate) * 500000;
> /* If more than one rate, set auto */
>


2023-07-11 21:24:04

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH net] wifi: airo: avoid uninitialized warning in airo_get_rate()

Hi Simon,

On 7/11/23 10:25, Simon Horman wrote:
> On Sun, Jul 09, 2023 at 06:31:54AM -0700, Randy Dunlap wrote:
>> Quieten a gcc (11.3.0) build error or warning by checking the function
>> call status and returning -EBUSY if the function call failed.
>> This is similar to what several other wireless drivers do for the
>> SIOCGIWRATE ioctl call when there is a locking problem.
>>
>> drivers/net/wireless/cisco/airo.c: error: 'status_rid.currentXmitRate' is used uninitialized [-Werror=uninitialized]
>
> Hi Randy,
>
> There seem to be other calls to readStatusRid() in the same file
> with similar properties. Perhaps it would be best to fix them too?
>

Yes, there are 40+ calls that could have problems.
Please see this thread:
https://lore.kernel.org/all/[email protected]/

This is an attempt to shut up the build error/warning, which only occurs after
this one function call.

For such an old driver/hardware, I don't plan to do massive surgery
to it.

>> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
>> Signed-off-by: Randy Dunlap <[email protected]>
>> Reported-by: Geert Uytterhoeven <[email protected]>
>> Link: lore.kernel.org/r/[email protected]
>> Cc: Kalle Valo <[email protected]>
>> Cc: [email protected]
>> Cc: "David S. Miller" <[email protected]>
>> Cc: Eric Dumazet <[email protected]>
>> Cc: Jakub Kicinski <[email protected]>
>> Cc: Paolo Abeni <[email protected]>
>> Cc: [email protected]
>> ---
>> drivers/net/wireless/cisco/airo.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff -- a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c
>> --- a/drivers/net/wireless/cisco/airo.c
>> +++ b/drivers/net/wireless/cisco/airo.c
>> @@ -6157,8 +6157,11 @@ static int airo_get_rate(struct net_devi
>> struct iw_param *vwrq = &wrqu->bitrate;
>> struct airo_info *local = dev->ml_priv;
>> StatusRid status_rid; /* Card status info */
>> + int ret;
>>
>> - readStatusRid(local, &status_rid, 1);
>> + ret = readStatusRid(local, &status_rid, 1);
>> + if (ret)
>> + return -EBUSY;
>>
>> vwrq->value = le16_to_cpu(status_rid.currentXmitRate) * 500000;
>> /* If more than one rate, set auto */
>>

--
~Randy