Skip to contentSkip to conversation

wifi: airo: avoid uninitialized warning in airo_get_rate()

PATCH Applied Randy Dunlap 3 participants 5 messages Jul 9, 2023 – Jul 13, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: airo: avoid uninitialized warning in airo_get_rate()

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]

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Link lore.kernel.org/r/[email protected]
Cc Kalle Valo <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
---
 drivers/net/wireless/cisco/airo.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/cisco/airo.c +4 -1
diff -- 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 */
#1 lore raw
Quoted 6 lines · Randy Dunlap

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?

Quoted 32 lines
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Link lore.kernel.org/r/[email protected]
Cc Kalle Valo <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[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

drivers/net/wireless/cisco/airo.c +4 -1
@@ -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 */
#2 lore raw

Hi Simon,

Quoted 6 lines · Simon Horman
Quoted 5 lines · Randy Dunlap

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.

Quoted 7 lines
Quoted 1 line

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.

Quoted 32 lines
Quoted 32 lines
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Link lore.kernel.org/r/[email protected]
Cc Kalle Valo <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[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

drivers/net/wireless/cisco/airo.c +4 -1
@@ -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 */
Signature · 1 line
~Randy
Reviewed-by
#3 lore raw
Quoted 21 lines · Randy Dunlap

Hi Simon,

Quoted 6 lines · Simon Horman
Quoted 5 lines · Randy Dunlap

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.

Quoted 7 lines
Quoted 1 line

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]/

Quoted 5 lines

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.

Thanks Randy,

given the circumstances I agree this is a reasonable approach.

#4 lore raw
In reply to Randy Dunlap
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Sun, 9 Jul 2023 06:31:54 -0700 you 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]

[...]

Here is the summary with links:
- [net] wifi: airo: avoid uninitialized warning in airo_get_rate()

    https://git.kernel.org/netdev/net/c/9373771aaed1

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html