mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Charles Han <hanchunchao@inspur.com>
To: <gregkh@linuxfoundation.org>, <alexandru.ardelean@analog.com>
Cc: <linux-kernel@vger.kernel.org>, Charles Han <hanchunchao@inspur.com>
Subject: [PATCH] uio: uio_fsl_elbc_gpcm: Add check devm_kasprintf() returned value
Date: Sun, 29 Sep 2024 11:42:23 +0800	[thread overview]
Message-ID: <20240929034223.59209-1-hanchunchao@inspur.com> (raw)

devm_kasprintf() can return a NULL pointer on failure but this
returned value in uio_fsl_elbc_gpcm_probe() is not checked.

Fixes: d57801c45f53 ("uio: uio_fsl_elbc_gpcm: use device-managed allocators")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
---
 drivers/uio/uio_fsl_elbc_gpcm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/uio/uio_fsl_elbc_gpcm.c b/drivers/uio/uio_fsl_elbc_gpcm.c
index 496caff66e7e..6378e752f828 100644
--- a/drivers/uio/uio_fsl_elbc_gpcm.c
+++ b/drivers/uio/uio_fsl_elbc_gpcm.c
@@ -384,6 +384,9 @@ static int uio_fsl_elbc_gpcm_probe(struct platform_device *pdev)
 
 	/* set all UIO data */
 	info->mem[0].name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOFn", node);
+	if (!info->mem[0].name)
+		return -ENOMEM;
+
 	info->mem[0].addr = res.start;
 	info->mem[0].size = resource_size(&res);
 	info->mem[0].memtype = UIO_MEM_PHYS;
-- 
2.31.1


             reply	other threads:[~2024-09-29  3:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-29  3:42 Charles Han [this message]
2024-10-13 15:16 ` Greg KH

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=20240929034223.59209-1-hanchunchao@inspur.com \
    --to=hanchunchao@inspur.com \
    --cc=alexandru.ardelean@analog.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@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®