joystick: off by one error
Subsystems (2)
PATCH 1/1 joystick: off by one error
This fixes a smatch warning:drivers/input/joystick/gamecon.c +838 gc_setup_pad(23) error: buffer overflow 'gc_names' 10 <= 10
Signed-off-by Dan Carpenter <[email protected]>
drivers/input/joystick/gamecon.c +1 -1
@@ -819,7 +819,7 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type)int i;int err; -if (pad_type <1 || pad_type >GC_MAX ) { +if (pad_type <1 || pad_type >=GC_MAX ) {pr_err ("Pad type %d unknown\n" , pad_type);return -EINVAL ; }
Quoted 3 lines · Dan Carpenter
This fixes a smatch warning:
drivers/input/joystick/gamecon.c+838gc_setup_pad(23)error: buffer overflow 'gc_names' 10 <= 10
Crap. I already sent this patch. I'm really sorry about that.
I will fix my QC process to not do this again.
regards,
dan carpenter
Quoted 15 lines
Signed-off-by Dan Carpenter <[email protected]>drivers/input/joystick/gamecon.c +1
-1@@ -819,7 +819,7 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type)int i;int err; -if (pad_type <1 || pad_type >GC_MAX ) { +if (pad_type <1 || pad_type >=GC_MAX ) {pr_err ("Pad type %d unknown\n" , pad_type);return -EINVAL ; }