mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
uio: uio_fsl_elbc_gpcm:: Add null pointer check to uio_fsl_elbc_gpcm_probe
[ Upstream commitd48fb15e6a] devm_kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Fixes:d57801c45f("uio: uio_fsl_elbc_gpcm: use device-managed allocators") Signed-off-by: Li Qiang <liqiang01@kylinos.cn> Link: https://patch.msgid.link/20251015064020.56589-1-liqiang01@kylinos.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
433e72bf0f
commit
285dadbb3c
@@ -384,6 +384,11 @@ 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) {
|
||||
ret = -ENODEV;
|
||||
goto out_err3;
|
||||
}
|
||||
|
||||
info->mem[0].addr = res.start;
|
||||
info->mem[0].size = resource_size(&res);
|
||||
info->mem[0].memtype = UIO_MEM_PHYS;
|
||||
@@ -423,6 +428,8 @@ static int uio_fsl_elbc_gpcm_probe(struct platform_device *pdev)
|
||||
out_err2:
|
||||
if (priv->shutdown)
|
||||
priv->shutdown(info, true);
|
||||
|
||||
out_err3:
|
||||
iounmap(info->mem[0].internal_addr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user