* [PATCH] spi: intel: Add check devm_kasprintf() returned value
@ 2024-08-30 7:41 Charles Han
2024-08-30 9:10 ` Mika Westerberg
2024-08-30 16:46 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Charles Han @ 2024-08-30 7:41 UTC (permalink / raw)
To: broonie, mika.westerberg; +Cc: linux-spi, linux-kernel, Charles Han
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: e58db3bcd93b ("spi: intel: Add default partition and name to the second chip")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
---
drivers/spi/spi-intel.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/spi/spi-intel.c b/drivers/spi/spi-intel.c
index 3e5dcf2b3c8a..795b7e72baea 100644
--- a/drivers/spi/spi-intel.c
+++ b/drivers/spi/spi-intel.c
@@ -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);
--
2.31.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: intel: Add check devm_kasprintf() returned value
2024-08-30 7:41 [PATCH] spi: intel: Add check devm_kasprintf() returned value Charles Han
@ 2024-08-30 9:10 ` Mika Westerberg
2024-08-30 16:46 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mika Westerberg @ 2024-08-30 9:10 UTC (permalink / raw)
To: Charles Han; +Cc: broonie, linux-spi, linux-kernel
On Fri, Aug 30, 2024 at 03:41:06PM +0800, Charles Han wrote:
> 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: e58db3bcd93b ("spi: intel: Add default partition and name to the second chip")
> Signed-off-by: Charles Han <hanchunchao@inspur.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: intel: Add check devm_kasprintf() returned value
2024-08-30 7:41 [PATCH] spi: intel: Add check devm_kasprintf() returned value Charles Han
2024-08-30 9:10 ` Mika Westerberg
@ 2024-08-30 16:46 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2024-08-30 16:46 UTC (permalink / raw)
To: mika.westerberg, Charles Han; +Cc: linux-spi, linux-kernel
On Fri, 30 Aug 2024 15:41:06 +0800, Charles Han wrote:
> 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.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: intel: Add check devm_kasprintf() returned value
commit: 2920294686ec23211637998f3ec386dfd3d784a6
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-30 16:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-30 7:41 [PATCH] spi: intel: Add check devm_kasprintf() returned value Charles Han
2024-08-30 9:10 ` Mika Westerberg
2024-08-30 16:46 ` Mark Brown
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®