[SCSI] ibmmca: fix buffer overflow
authorRoel Kluin <roel.kluin@gmail.com>
Tue, 8 Dec 2009 22:08:56 +0000 (14:08 -0800)
committerJames Bottomley <James.Bottomley@suse.de>
Mon, 18 Jan 2010 16:48:08 +0000 (10:48 -0600)
Allows i == IM_MAX_HOSTS, which is out of range.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/ibmmca.c

index 9c1e6a5b5af0ab9755f4fd69cda41f8fce91b9ca..9a4b69d4f4eb0d80c47117963cecbef3b2a1ebc2 100644 (file)
@@ -2336,7 +2336,7 @@ static int option_setup(char *str)
        char *cur = str;
        int i = 1;
 
-       while (cur && isdigit(*cur) && i <= IM_MAX_HOSTS) {
+       while (cur && isdigit(*cur) && i < IM_MAX_HOSTS) {
                ints[i++] = simple_strtoul(cur, NULL, 0);
                if ((cur = strchr(cur, ',')) != NULL)
                        cur++;