Commit a09a5aa8 authored by Li Qiang's avatar Li Qiang Committed by Guenter Roeck
Browse files

hwmon: (cgbc-hwmon) Add missing NULL check after devm_kzalloc()



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: default avatarLi Qiang <liqiang01@kylinos.cn>
Fixes: 08ebc9de ("hwmon: Add Congatec Board Controller monitoring driver")
Reviewed-by: default avatarThomas Richard <thomas.richard@bootlin.com>
Link: https://lore.kernel.org/r/20251017063414.1557447-1-liqiang01@kylinos.cn


Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 57f6f479
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment