* [PATCH v2] brcmfmac: check the return value of devm_kzalloc() in brcmf_of_probe()
@ 2022-03-11 2:17 Jia-Ju Bai
2022-03-16 15:27 ` Kalle Valo
0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2022-03-11 2:17 UTC (permalink / raw)
To: aspriel, franky.lin, hante.meuleman, chi-hsien.lin, wright.feng,
chung-hsien.hsu, kvalo, davem, kuba, len.baker, gustavoars,
shawn.guo
Cc: linux-wireless, brcm80211-dev-list.pdl, SHA-cyfmac-dev-list,
netdev, linux-kernel, Jia-Ju Bai
The function devm_kzalloc() in brcmf_of_probe() can fail, so its return
value should be checked.
Fixes: 29e354ebeeec ("brcmfmac: Transform compatible string for FW loading")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
v2:
* Add of_node_put() in error handling path.
Thank Kalle for good advice.
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
index 513c7e6421b2..15eb96e288af 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
@@ -80,6 +80,10 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
/* get rid of '/' in the compatible string to be able to find the FW */
len = strlen(tmp) + 1;
board_type = devm_kzalloc(dev, len, GFP_KERNEL);
+ if (!board_type) {
+ of_node_put(root);
+ return;
+ }
strscpy(board_type, tmp, len);
for (i = 0; i < board_type[i]; i++) {
if (board_type[i] == '/')
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] brcmfmac: check the return value of devm_kzalloc() in brcmf_of_probe()
2022-03-11 2:17 [PATCH v2] brcmfmac: check the return value of devm_kzalloc() in brcmf_of_probe() Jia-Ju Bai
@ 2022-03-16 15:27 ` Kalle Valo
0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2022-03-16 15:27 UTC (permalink / raw)
To: Jia-Ju Bai
Cc: aspriel, franky.lin, hante.meuleman, chi-hsien.lin, wright.feng,
chung-hsien.hsu, davem, kuba, len.baker, gustavoars, shawn.guo,
linux-wireless, brcm80211-dev-list.pdl, SHA-cyfmac-dev-list,
netdev, linux-kernel, Jia-Ju Bai
Jia-Ju Bai <baijiaju1990@gmail.com> wrote:
> The function devm_kzalloc() in brcmf_of_probe() can fail, so its return
> value should be checked.
>
> Fixes: 29e354ebeeec ("brcmfmac: Transform compatible string for FW loading")
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Fails to apply to wireless-next:
Recorded preimage for 'drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c'
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: brcmfmac: check the return value of devm_kzalloc() in brcmf_of_probe()
Using index info to reconstruct a base tree...
M drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
CONFLICT (content): Merge conflict in drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
Patch failed at 0001 brcmfmac: check the return value of devm_kzalloc() in brcmf_of_probe()
Patch set to Changes Requested.
--
https://patchwork.kernel.org/project/linux-wireless/patch/20220311021751.29958-1-baijiaju1990@gmail.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-16 15:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-11 2:17 [PATCH v2] brcmfmac: check the return value of devm_kzalloc() in brcmf_of_probe() Jia-Ju Bai
2022-03-16 15:27 ` Kalle Valo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.