]> git.baikalelectronics.ru Git - kernel.git/commit
HID: logitech-hidpp: check name retrieval return code
authorPeter Wu <peter@lekensteyn.nl>
Thu, 11 Dec 2014 12:51:18 +0000 (13:51 +0100)
committerJiri Kosina <jkosina@suse.cz>
Thu, 11 Dec 2014 22:10:00 +0000 (23:10 +0100)
commita4282e9179a7984f59a68d9a6dadfbe5ec72d47f
treeb16d64b16d3f19f4675bc9787719795d1601d96c
parent5484618e96d6f498dff793bce04bbd572c9c1eb5
HID: logitech-hidpp: check name retrieval return code

hidpp_devicenametype_get_device_name() may return a negative value on
protocol errors (for example, when the device is powered off).
Explicitly check this condition to avoid a long-running loop.

(0 cannot be returned as __name_length - index > 0, but check for it
anyway as it would otherwise result in an infinite loop.)

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-logitech-hidpp.c