[PATCH v2] ASoC: samsung: i2s: check the return value of kstrdup()
From: Xiaoke Wang xkernel.wang@foxmail.com
kstrdup() is a memory allocation function which can return NULL when some internal memory errors happen. It is better to check the return value of it to catch the error in time.
Reviewed-by: Krzysztof Kozlowski krzysztof.kozlowski@canonical.com Signed-off-by: Xiaoke Wang xkernel.wang@foxmail.com --- ChangeLog: v1->v2 update the mail list and attach the tag 'Reviewed-by'. sound/soc/samsung/i2s.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 309badc..70c8271 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1349,6 +1349,10 @@ static int i2s_create_secondary_device(struct samsung_i2s_priv *priv) return -ENOMEM;
pdev_sec->driver_override = kstrdup("samsung-i2s", GFP_KERNEL); + if (!pdev_sec->driver_override) { + platform_device_put(pdev_sec); + return -ENOMEM; + }
ret = platform_device_add(pdev_sec); if (ret < 0) { --
On Mon, 14 Mar 2022 18:36:45 +0800, xkernel.wang@foxmail.com wrote:
From: Xiaoke Wang xkernel.wang@foxmail.com
kstrdup() is a memory allocation function which can return NULL when some internal memory errors happen. It is better to check the return value of it to catch the error in time.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: samsung: i2s: check the return value of kstrdup() commit: d39664cb758e9e329ac3ba05bd4f813f928f63c2
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
participants (2)
-
Mark Brown
-
xkernel.wang@foxmail.com