Commit 929b60a8 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Jiri Kosina

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: default avatarGustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 4cf56a89
...@@ -2732,6 +2732,9 @@ static int hidpp_initialize_battery(struct hidpp_device *hidpp) ...@@ -2732,6 +2732,9 @@ static int hidpp_initialize_battery(struct hidpp_device *hidpp)
hidpp_battery_props, hidpp_battery_props,
sizeof(hidpp_battery_props), sizeof(hidpp_battery_props),
GFP_KERNEL); GFP_KERNEL);
if (!battery_props)
return -ENOMEM;
num_battery_props = ARRAY_SIZE(hidpp_battery_props) - 2; num_battery_props = ARRAY_SIZE(hidpp_battery_props) - 2;
if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_MILEAGE) if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_MILEAGE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment