mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
HID: hid-logitech-hidpp: add NULL check on devm_kmemdup() return value
Check return value from call to devm_kmemdup() in order to prevent a NULL pointer dereference. Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
4cf56a89c6
commit
929b60a85b
@ -2732,6 +2732,9 @@ static int hidpp_initialize_battery(struct hidpp_device *hidpp)
|
||||
hidpp_battery_props,
|
||||
sizeof(hidpp_battery_props),
|
||||
GFP_KERNEL);
|
||||
if (!battery_props)
|
||||
return -ENOMEM;
|
||||
|
||||
num_battery_props = ARRAY_SIZE(hidpp_battery_props) - 2;
|
||||
|
||||
if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_MILEAGE)
|
||||
|
Loading…
Reference in New Issue
Block a user