From: Hans de Goede Date: Sat, 20 Apr 2019 11:22:06 +0000 (+0200) Subject: HID: logitech-hidpp: ignore very-short or empty names X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=22bf6bdef4a1d551fdaebbe8247e57569ea07b6a;p=linux.git 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 Signed-off-by: Benjamin Tissoires --- diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index b389fcc1a894f..e7f082374943e 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;