From: Krzysztof Kozlowski <krzk@kernel.org>
To: Henry Martin <bsdhenrymartin@gmail.com>,
joel@jms.id.au, andrew@codeconstruct.com.au
Cc: herve.codina@bootlin.com, gsomlo@gmail.com, heiko@sntech.de,
andersson@kernel.org, u.kleine-koenig@baylibre.com,
linux-arm-kernel@lists.infradead.org,
linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/misc: Add NULL check in aspeed_lpc_enable_snoop
Date: Mon, 31 Mar 2025 13:40:19 +0200 [thread overview]
Message-ID: <76836050-a701-4d6e-859e-8aed23d234a2@kernel.org> (raw)
In-Reply-To: <20250331093922.7735-1-bsdhenrymartin@gmail.com>
On 31/03/2025 11:39, Henry Martin wrote:
> When devm_kasprintf() fails, it returns a NULL pointer. However, this return value is not properly checked in the function aspeed_lpc_enable_snoop.
>
> A NULL check should be added after the devm_kasprintf() to prevent potential NULL pointer dereference error.
>
Same comments.
> Fixes: 3772e5da44542 ("Aspeed LPC snoop output using misc chardev")
>
There is never a blank line between tags.
> Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
> ---
> drivers/soc/aspeed/aspeed-lpc-snoop.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c
> index 9ab5ba9cf1d6..376b3a910797 100644
> --- a/drivers/soc/aspeed/aspeed-lpc-snoop.c
> +++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c
> @@ -200,6 +200,8 @@ static int aspeed_lpc_enable_snoop(struct aspeed_lpc_snoop *lpc_snoop,
> lpc_snoop->chan[channel].miscdev.minor = MISC_DYNAMIC_MINOR;
> lpc_snoop->chan[channel].miscdev.name =
> devm_kasprintf(dev, GFP_KERNEL, "%s%d", DEVICE_NAME, channel);
> + if (!lpc_snoop->chan[channel].miscdev.name)
> + return -ENOMEM;
Missing cleanup.
Best regards,
Krzysztof
prev parent reply other threads:[~2025-03-31 11:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-31 9:39 Henry Martin
2025-03-31 11:40 ` Krzysztof Kozlowski [this message]
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=76836050-a701-4d6e-859e-8aed23d234a2@kernel.org \
--to=krzk@kernel.org \
--cc=andersson@kernel.org \
--cc=andrew@codeconstruct.com.au \
--cc=bsdhenrymartin@gmail.com \
--cc=gsomlo@gmail.com \
--cc=heiko@sntech.de \
--cc=herve.codina@bootlin.com \
--cc=joel@jms.id.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.com \
/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®