]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ARM: imx: Check return value of devm_kasprintf in imx_mmdc_perf_init
authorKunwu Chan <chentao@kylinos.cn>
Wed, 22 Nov 2023 06:46:36 +0000 (14:46 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Dec 2023 17:36:41 +0000 (18:36 +0100)
commitcb2034c02ffa0c6f8ddabcfdfb6545fb5790d980
tree98bcbd7640235f983e42a63ddd8a5687915fd823
parent800aabe1eda16cfcd837133571c4716d67759bbd
ARM: imx: Check return value of devm_kasprintf in imx_mmdc_perf_init

[ Upstream commit 1c2b1049af3f86545fcc5fae0fc725fb64b3a09e ]

devm_kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure. Ensure the allocation was successful
by checking the pointer validity.

Release the id allocated in 'mmdc_pmu_init' when 'devm_kasprintf'
return NULL

Suggested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Fixes: e76bdfd7403a ("ARM: imx: Added perf functionality to mmdc driver")
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm/mach-imx/mmdc.c