* [PATCH] brcmfmac: check the return value of devm_kzalloc() in brcmf_of_probe()
@ 2022-02-25 13:21 Jia-Ju Bai
2022-03-10 16:09 ` Kalle Valo
0 siblings, 1 reply; 3+ messages in thread
From: Jia-Ju Bai @ 2022-02-25 13:21 UTC (permalink / raw)
To: aspriel, franky.lin, hante.meuleman, chi-hsien.lin, wright.feng,
chung-hsien.hsu, kvalo, davem, kuba, shawn.guo, gustavoars,
len.baker
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>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
index 513c7e6421b2..535e8ddeab8d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
@@ -80,6 +80,8 @@ 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)
+ 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] 3+ messages in thread
* Re: [PATCH] brcmfmac: check the return value of devm_kzalloc() in brcmf_of_probe()
2022-02-25 13:21 [PATCH] brcmfmac: check the return value of devm_kzalloc() in brcmf_of_probe() Jia-Ju Bai
@ 2022-03-10 16:09 ` Kalle Valo
2022-03-11 2:16 ` Jia-Ju Bai
0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2022-03-10 16:09 UTC (permalink / raw)
To: Jia-Ju Bai
Cc: aspriel, franky.lin, hante.meuleman, chi-hsien.lin, wright.feng,
chung-hsien.hsu, davem, kuba, shawn.guo, gustavoars, len.baker,
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>
You are not calling of_node_put() in the error path. And I don't think
this even applies.
Patch set to Changes Requested.
--
https://patchwork.kernel.org/project/linux-wireless/patch/20220225132138.27722-1-baijiaju1990@gmail.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] brcmfmac: check the return value of devm_kzalloc() in brcmf_of_probe()
2022-03-10 16:09 ` Kalle Valo
@ 2022-03-11 2:16 ` Jia-Ju Bai
0 siblings, 0 replies; 3+ messages in thread
From: Jia-Ju Bai @ 2022-03-11 2:16 UTC (permalink / raw)
To: Kalle Valo
Cc: aspriel, franky.lin, hante.meuleman, chi-hsien.lin, wright.feng,
chung-hsien.hsu, davem, kuba, shawn.guo, gustavoars, len.baker,
linux-wireless, brcm80211-dev-list.pdl, SHA-cyfmac-dev-list,
netdev, linux-kernel
On 2022/3/11 0:09, Kalle Valo wrote:
> 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>
> You are not calling of_node_put() in the error path. And I don't think
> this even applies.
>
> Patch set to Changes Requested.
>
Hi Kalle,
Thanks for the reply :)
I will add of_node_put() and send a V2 patch.
Best wishes,
Jia-Ju Bai
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-11 2:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-25 13:21 [PATCH] brcmfmac: check the return value of devm_kzalloc() in brcmf_of_probe() Jia-Ju Bai
2022-03-10 16:09 ` Kalle Valo
2022-03-11 2:16 ` Jia-Ju Bai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).