summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2019-04-20 13:22:06 +0200
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>2019-04-23 18:02:43 +0200
commit22bf6bdef4a1d551fdaebbe8247e57569ea07b6a (patch)
treedb4cc1cbdfc62cb5bf688cc83491d95535b43510 /drivers/hid
parent91cf9a98ae4127551d022e287e283bcd8738ed02 (diff)
HID: logitech-hidpp: ignore very-short or empty names
Some devices report an empty or very short name, in this case stick with the name generated by the logitech-dj code instead of overriding it with e.g. "Logitech ". Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-logitech-hidpp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index b389fcc1a894..e7f082374943 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -741,6 +741,9 @@ static char *hidpp_unifying_get_name(struct hidpp_device *hidpp_dev)
if (2 + len > sizeof(response.rap.params))
return NULL;
+ if (len < 4) /* logitech devices are usually at least Xddd */
+ return NULL;
+
name = kzalloc(len + 1, GFP_KERNEL);
if (!name)
return NULL;