From: Arend Van Spriel <arend.vanspriel@broadcom.com>
To: Henry Martin <bsdhenrymartin@gmail.com>
Cc: <linux-wireless@vger.kernel.org>, <brcm80211@lists.linux.dev>,
<brcm80211-dev-list.pdl@broadcom.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] wifi: brcmfmac: acpi: Add NULL check in brcmf_acpi_probe()
Date: Tue, 01 Apr 2025 18:57:42 +0200 [thread overview]
Message-ID: <195f2498f70.279b.9b12b7fc0a3841636cfb5e919b41b954@broadcom.com> (raw)
In-Reply-To: <20250401140924.29168-1-bsdhenrymartin@gmail.com>
On April 1, 2025 4:09:36 PM Henry Martin <bsdhenrymartin@gmail.com> wrote:
> devm_kasprintf() returns NULL when memory allocation fails. Currently,
> brcmf_acpi_probe() does not check for this case, which results in a NULL
> pointer dereference.
>
> Add NULL check after devm_kasprintf() to prevent this issue.
>
> Fixes: 0f485805d008 ("wifi: brcmfmac: acpi: Add support for fetching Apple
> ACPI properties")
> Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/acpi.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/acpi.c
> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/acpi.c
> index c4a54861bfb4..4885d5d0a0af 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/acpi.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/acpi.c
> @@ -25,6 +25,8 @@ void brcmf_acpi_probe(struct device *dev, enum
> brcmf_bus_type bus_type,
> settings->board_type = devm_kasprintf(dev, GFP_KERNEL,
> "apple,%s",
> o->string.pointer);
> + if (!settings->board_type)
> + return -ENOMEM;
brcmf_acpi_probe() has void return type so this would give a compiler
warning. I expect submitted patches at least do pass compilation.
After digging through the driver code I see a null check everywhere it is
used. Can you please provide a kernel log with a null deref so I may have a
clue where it goes wrong? If any.
Regards,
Arend
>
next prev parent reply other threads:[~2025-04-01 16:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-01 14:09 Henry Martin
2025-04-01 16:57 ` Arend Van Spriel [this message]
2025-04-02 2:22 ` [PATCH] clk: bcm: rpi: Fix NULL check after devm_kasprintf() Henry Martin
2025-04-02 10:32 ` Arend van Spriel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=195f2498f70.279b.9b12b7fc0a3841636cfb5e919b41b954@broadcom.com \
--to=arend.vanspriel@broadcom.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=brcm80211@lists.linux.dev \
--cc=bsdhenrymartin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®