[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fd8d7d4c-adcf-4703-9804-09a35aefc24f@roeck-us.net>
Date: Fri, 17 Oct 2025 05:42:30 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Li Qiang <liqiang01@...inos.cn>
Cc: thomas.richard@...tlin.com, linux-hwmon@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hwmon: cgbc-hwmon: Add missing NULL check after
devm_kzalloc()
On Fri, Oct 17, 2025 at 02:34:14PM +0800, Li Qiang wrote:
> The driver allocates memory for sensor data using devm_kzalloc(), but
> did not check if the allocation succeeded. In case of memory allocation
> failure, dereferencing the NULL pointer would lead to a kernel crash.
>
> Add a NULL pointer check and return -ENOMEM to handle allocation failure
> properly.
>
> Signed-off-by: Li Qiang <liqiang01@...inos.cn>
> Reviewed-by: Thomas Richard <thomas.richard@...tlin.com>
Applied.
Guenter
Powered by blists - more mailing lists