Skip to contentSkip to conversation

gamecon: fix off by one range check

PATCH Applied Dan Carpenter 2 participants 2 messages Mar 3, 2010 – Mar 5, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gamecon: fix off by one range check

It should be >= GC_MAX not > GC_MAX.

drivers/input/joystick/gamecon.c +1 -1
index ae998d9..7a55714 100644
@@ -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;
 	}