diff options
author | Gustavo A. R. Silva <garsilva@embeddedor.com> | 2017-07-07 07:12:13 +0200 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2017-07-20 15:45:39 +0200 |
commit | 929b60a85b731d803f2b7829149496479eba0b20 (patch) | |
tree | 7ca4a14932399a76a23d1e69b6aad4b694baefb2 /drivers/hid/hid-logitech-hidpp.c | |
parent | HID: multitouch: do not blindly set EV_KEY or EV_ABS bits (diff) | |
download | linux-929b60a85b731d803f2b7829149496479eba0b20.tar.xz linux-929b60a85b731d803f2b7829149496479eba0b20.zip |
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>
Diffstat (limited to 'drivers/hid/hid-logitech-hidpp.c')
-rw-r--r-- | drivers/hid/hid-logitech-hidpp.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index 41b39464ded8..501e16a9227d 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c @@ -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) |