[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240929034223.59209-1-hanchunchao@inspur.com>
Date: Sun, 29 Sep 2024 11:42:23 +0800
From: Charles Han <hanchunchao@...pur.com>
To: <gregkh@...uxfoundation.org>, <alexandru.ardelean@...log.com>
CC: <linux-kernel@...r.kernel.org>, Charles Han <hanchunchao@...pur.com>
Subject: [PATCH] uio: uio_fsl_elbc_gpcm: Add check devm_kasprintf() returned value
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@...pur.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
Powered by blists - more mailing lists