Skip to contentSkip to conversation

rsi: fix error return code of rsi_load_9116_firmware()

PATCH In review Jia-Ju Bai 2 participants 2 messages Mar 7, 2021 – Apr 18, 2021

Subsystems (3)
lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

PATCH 1/1 rsi: fix error return code of rsi_load_9116_firmware()

When kmemdup() returns NULL to ta_firmware, no error return code of rsi_load_9116_firmware() is assigned.
To fix this bug, status is assigned with -ENOMEM in this case.

---
 drivers/net/wireless/rsi/rsi_91x_hal.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/rsi/rsi_91x_hal.c +3 -1
index ce9892152f4d..32ecb8b3d6c5 100644
@@ -1038,8 +1038,10 @@ static int rsi_load_9116_firmware(struct rsi_hw *adapter)
 	}
 
 	ta_firmware = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
-	if (!ta_firmware)
+	if (!ta_firmware) {
+		status = -ENOMEM;
 		goto fail_release_fw;
+	}
 	fw_p = ta_firmware;
 	instructions_sz = fw_entry->size;
 	rsi_dbg(INFO_ZONE, "FW Length = %d bytes\n", instructions_sz);
Signature · 1 line
2.17.1
#1 lore raw
Quoted 6 lines · Jia-Ju Bai

When kmemdup() returns NULL to ta_firmware, no error return code of rsi_load_9116_firmware() is assigned.
To fix this bug, status is assigned with -ENOMEM in this case.

Someone needs to review this.

Patch set to Changes Requested.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches