uio: uio_fsl_elbc_gpcm:: Add null pointer check to uio_fsl_elbc_gpcm_probe
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>
pull/1354/merge
parent
18e4a02963
commit
d48fb15e6a
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue