Skip to content
Commit 01511ac7 authored by Duoming Zhou's avatar Duoming Zhou Committed by Sasha Levin
Browse files

clk: zynq: Prevent null pointer dereference caused by kmalloc failure

[ Upstream commit 7938e9ce ]

The kmalloc() in zynq_clk_setup() will return null if the
physical memory has run out. As a result, if we use snprintf()
to write data to the null address, the null pointer dereference
bug will happen.

This patch uses a stack variable to replace the kmalloc().

Fixes: 0ee52b15

 ("clk: zynq: Add clock controller driver")
Suggested-by: default avatarMichal Simek <michal.simek@amd.com>
Suggested-by: default avatarStephen Boyd <sboyd@kernel.org>
Signed-off-by: default avatarDuoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20240301084437.16084-1-duoming@zju.edu.cn
Acked-by: default avatarMichal Simek <michal.simek@amd.com>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 0efb9ef6
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