linux-stable/drivers/clk/zynq
Duoming Zhou 8c4889a9ea clk: zynq: Prevent null pointer dereference caused by kmalloc failure
[ Upstream commit 7938e9ce39 ]

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: 0ee52b157b ("clk: zynq: Add clock controller driver")
Suggested-by: Michal Simek <michal.simek@amd.com>
Suggested-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20240301084437.16084-1-duoming@zju.edu.cn
Acked-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-26 18:20:53 -04:00
..
clkc.c clk: zynq: Prevent null pointer dereference caused by kmalloc failure 2024-03-26 18:20:53 -04:00
Makefile
pll.c clk: zynq: pll: Fix kernel-doc warnings 2021-12-02 17:27:24 -08:00