diff mbox series

[RFC] net: wireless: cisco: Fix possible uninit bug

Message ID 20230711052310.3294305-1-yhao016@ucr.edu
State New
Headers show
Series [RFC] net: wireless: cisco: Fix possible uninit bug | expand

Commit Message

Yu Hao July 11, 2023, 5:23 a.m. UTC
The struct cap_rid should be initialized by function readCapabilityRid.
However, there is not return value check. Iit is possible that
the function readCapabilityRid returns error code and cap_rid.softCap
is not initialized. But there is a read later for this field.

Signed-off-by: Yu Hao <yhao016@ucr.edu>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/net/wireless/cisco/airo.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c
index 7c4cc5f5e1eb..391ac1e9e261 100644
--- a/drivers/net/wireless/cisco/airo.c
+++ b/drivers/net/wireless/cisco/airo.c
@@ -6950,8 +6950,11 @@  static int airo_get_range(struct net_device *dev,
 	CapabilityRid cap_rid;		/* Card capability info */
 	int		i;
 	int		k;
+	int		status;
 
-	readCapabilityRid(local, &cap_rid, 1);
+	status = readCapabilityRid(local, &cap_rid, 1);
+	if (status != SUCCESS)
+		return -EINVAL;
 
 	dwrq->length = sizeof(struct iw_range);
 	memset(range, 0, sizeof(*range));