Re: [PATCH] clk/x86: pmc_atom: add kasprintf return value check
From: Brian Masney
Date: Thu Jul 16 2026 - 10:48:28 EST
On Tue, Jul 14, 2026 at 02:51:32PM +0800, longlong yan wrote:
> The kasprintf() function returns NULL on memory allocation failure, but
> the code in plt_clk_register() was not checking this return value. If
> kasprintf fails, init.name would be NULL and could cause NULL pointer
> dereference when clkdev_hw_create() uses it.
>
> Add proper error checking for the kasprintf() return value and return
> ERR_PTR(-ENOMEM) on failure.
>
> Fixes: 1141d9d08184 ("clk: x86: Add Atom PMC platform clocks")
> Signed-off-by: longlong yan <yanlonglong@xxxxxxxxxx>
Reviewed-by: Brian Masney <bmasney@xxxxxxxxxx>