lkml.org 
[lkml]   [2013]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/5] USB: HID: SRW-S1 Gaming Wheel Driver
On Thu, 31 Jan 2013, simon@mungewell.org wrote:

> > I thought we converged to hid-steelseries name in the end originally?
> >
> > If you agree, I'll change it and apply.
>
> I'd be OK with that,

Thanks. I will also apply this patch on top, otherwise we'll be corrupting
memory in steelseries_srws1_probe() here:

drv_data->led[SRWS1_NUMBER_LEDS] = led;



From: Jiri Kosina <jkosina@suse.cz>
Subject: [PATCH] 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 <jkosina@suse.cz>
---
drivers/hid/hid-steelseries.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c
index 365bc9e..2ed995c 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

--
Jiri Kosina
SUSE Labs

\
 
 \ /
  Last update: 2013-01-31 17:42    [W:0.044 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site