Check whether index is within bounds before testing the element. Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx> --- declared in drivers/hid/usbhid/hid-core.c:62: static char *quirks_param[MAX_USBHID_BOOT_QUIRKS] = ... diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index d8f7423..0d9045a 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c @@ -201,7 +201,7 @@ int usbhid_quirks_init(char **quirks_param) u32 quirks; int n = 0, m; - for (; quirks_param[n] && n < MAX_USBHID_BOOT_QUIRKS; n++) { + for (; n < MAX_USBHID_BOOT_QUIRKS && quirks_param[n]; n++) { m = sscanf(quirks_param[n], "0x%hx:0x%hx:0x%x", &idVendor, &idProduct, &quirks); -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html