From: Jiri Kosina Date: Thu, 31 Jan 2013 15:51:47 +0000 (+0100) Subject: HID: steelseries: fix out of bound array access X-Git-Tag: firefly_0821_release~3680^2~1065^2^3 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7e41576247b782a21c05f7ea8a78a6db119ba789;p=firefly-linux-kernel-4.4.55.git HID: steelseries: fix out of bound array access The last field of the driver_data->leds[] array is used to store the special toggle for setting all leds simultaneously, so we need to allocate appropriate number of led_classdev pointers. Signed-off-by: Jiri Kosina --- diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c index 365bc9ef1e79..2ed995cda44a 100644 --- a/drivers/hid/hid-steelseries.c +++ b/drivers/hid/hid-steelseries.c @@ -23,7 +23,8 @@ #define SRWS1_NUMBER_LEDS 15 struct steelseries_srws1_data { __u16 led_state; - struct led_classdev *led[SRWS1_NUMBER_LEDS]; + /* the last element is used for setting all leds simultaneously */ + struct led_classdev *led[SRWS1_NUMBER_LEDS + 1]; }; #endif