Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Li Jun <lijun01@kylinos.cn>
Cc: Frank.Li@nxp.com, s.hauer@pengutronix.de, imx@lists.linux.dev,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de,
	festevam@gmail.com, peng.fan@nxp.com, shawnguo@kernel.org,
	krzysztof.kozlowski@oss.qualcomm.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] firmware: imx: sm-misc: Add NULL check for kmalloc in syslog_show
Date: Tue, 9 Jun 2026 10:38:15 -0500	[thread overview]
Message-ID: <aigzZ8_uGT8bCzWc@SMW015318> (raw)
In-Reply-To: <20260609004504.3402281-1-lijun01@kylinos.cn>

On Tue, Jun 09, 2026 at 08:45:04AM +0800, Li Jun wrote:
>
> Add a proper NULL check for the kmalloc() return value in syslog_show().
> If memory allocation fails, syslog would be NULL and passing it to
> misc_syslog() could lead to a NULL pointer dereference.
>
> Signed-off-by: Li Jun <lijun01@kylinos.cn>
> ---

Add a fix tags

Frank

>  drivers/firmware/imx/sm-misc.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/firmware/imx/sm-misc.c b/drivers/firmware/imx/sm-misc.c
> index ac9af824c2d4..fb8d7bdb5b08 100644
> --- a/drivers/firmware/imx/sm-misc.c
> +++ b/drivers/firmware/imx/sm-misc.c
> @@ -79,6 +79,9 @@ static int syslog_show(struct seq_file *file, void *priv)
>         u16 size = SZ_4K / 4;
>         int ret;
>
> +       if (!syslog)
> +               return -ENOMEM;
> +
>         if (!ph)
>                 return -ENODEV;
>
> --
> 2.25.1
>
>


  reply	other threads:[~2026-06-09 15:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09  0:45 [PATCH] firmware: imx: sm-misc: Add NULL check for kmalloc in syslog_show Li Jun
2026-06-09 15:38 ` Frank Li [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-06-10  0:38 Li Jun
2026-06-29 20:41 ` Frank.Li

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=aigzZ8_uGT8bCzWc@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=lijun01@kylinos.cn \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@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