Commit 29202946 authored by Charles Han's avatar Charles Han Committed by Mark Brown

spi: intel: Add check devm_kasprintf() returned value

intel_spi_populate_chip() use devm_kasprintf() to set pdata->name.
This can return a NULL pointer on failure but this returned value
is not checked.

Fixes: e58db3bc ("spi: intel: Add default partition and name to the second chip")
Signed-off-by: default avatarCharles Han <hanchunchao@inspur.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Link: https://patch.msgid.link/20240830074106.8744-1-hanchunchao@inspur.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5f3eee1e
......@@ -1390,6 +1390,9 @@ static int intel_spi_populate_chip(struct intel_spi *ispi)
pdata->name = devm_kasprintf(ispi->dev, GFP_KERNEL, "%s-chip1",
dev_name(ispi->dev));
if (!pdata->name)
return -ENOMEM;
pdata->nr_parts = 1;
parts = devm_kcalloc(ispi->dev, pdata->nr_parts, sizeof(*parts),
GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment