[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ecd0d0f-6b9b-16aa-e270-d6095865fbc2@broadcom.com>
Date: Wed, 19 Jan 2022 13:35:09 +0100
From: Arend van Spriel <arend.vanspriel@...adcom.com>
To: Hector Martin <marcan@...can.st>,
Kalle Valo <kvalo@...eaurora.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>,
Arend van Spriel <aspriel@...il.com>,
Franky Lin <franky.lin@...adcom.com>,
Hante Meuleman <hante.meuleman@...adcom.com>,
Chi-hsien Lin <chi-hsien.lin@...ineon.com>,
Wright Feng <wright.feng@...ineon.com>,
Dmitry Osipenko <digetx@...il.com>
Cc: Sven Peter <sven@...npeter.dev>,
Alyssa Rosenzweig <alyssa@...enzweig.io>,
Mark Kettenis <kettenis@...nbsd.org>,
Rafał Miłecki <zajec5@...il.com>,
Pieter-Paul Giesberts <pieter-paul.giesberts@...adcom.com>,
Linus Walleij <linus.walleij@...aro.org>,
Hans de Goede <hdegoede@...hat.com>,
"John W. Linville" <linville@...driver.com>,
"brian m. carlson" <sandals@...stytoothpaste.net>,
Andy Shevchenko <andy.shevchenko@...il.com>,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-acpi@...r.kernel.org, brcm80211-dev-list.pdl@...adcom.com,
SHA-cyfmac-dev-list@...ineon.com
Subject: Re: [PATCH v3 7/9] brcmfmac: of: Use devm_kstrdup for board_type &
check for errors
On 1/17/2022 3:29 PM, Hector Martin wrote:
> This was missing a NULL check, and we can collapse the strlen/alloc/copy
> into a devm_kstrdup().
Reviewed-by: Arend van Spriel <arend.vanspriel@...adcom.com>
> Signed-off-by: Hector Martin <marcan@...can.st>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
> index 513c7e6421b2..5dc1e942e9e7 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
> @@ -79,8 +79,12 @@ 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);
> - strscpy(board_type, tmp, len);
> + board_type = devm_kstrdup(dev, tmp, GFP_KERNEL);
> + if (!board_type) {
> + brcmf_err("out of memory allocating board_type\n");
Drop the message. mm will blurb out with a stack trace providing all the
info you need.
> + of_node_put(root);
> + return;
> + }
> for (i = 0; i < board_type[i]; i++) {
> if (board_type[i] == '/')
> board_type[i] = '-';
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4219 bytes)
Powered by blists - more mailing lists