Re: [PATCH v4] clk: zynq: Prevent null pointer dereference caused by kmalloc failure

From: Stephen Boyd
Date: Fri Mar 08 2024 - 20:15:49 EST


Quoting Duoming Zhou (2024-03-01 00:44:37)
> 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: 0ee52b157b8e ("clk: zynq: Add clock controller driver")
> Suggested-by: Michal Simek <michal.simek@xxxxxxx>
> Suggested-by: Stephen Boyd <sboyd@xxxxxxxxxx>
> Signed-off-by: Duoming Zhou <duoming@xxxxxxxxxx>
> ---

Applied to clk-next