Skip to content

Commit

Permalink
HID: steelseries: fix out of bound array access
Browse files Browse the repository at this point in the history
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 <jkosina@suse.cz>
  • Loading branch information
Jiri Kosina committed Jan 31, 2013
1 parent 090800c commit 7e41576
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/hid/hid-steelseries.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7e41576

Please sign in to comment.