Commit 9ee03f2e authored by Kunwu Chan's avatar Kunwu Chan Committed by Zheng Zengkai
Browse files

ARM: imx: Check return value of devm_kasprintf in imx_mmdc_perf_init

stable inclusion
from stable-v6.6.7
commit 12deaef0c8670064022819ef346ad05a692f5c69
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8SSQ4

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=12deaef0c8670064022819ef346ad05a692f5c69



--------------------------------

[ 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: default avatarAhmad Fatoum <a.fatoum@pengutronix.de>
Fixes: e76bdfd7 ("ARM: imx: Added perf functionality to mmdc driver")
Signed-off-by: default avatarKunwu Chan <chentao@kylinos.cn>
Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent de850754
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment