tile: array underflow in setup_maxnodemem()
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 22 Jul 2017 07:33:02 +0000 (10:33 +0300)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 1 Jan 2018 20:50:48 +0000 (20:50 +0000)
commit 637f23abca87d26e091e0d6647ec878d97d2c6cd upstream.

My static checker correctly complains that we should have a lower bound
on "node" to prevent an array underflow.

Fixes: 867e359b97c9 ("arch/tile: core support for Tilera 32-bit chips.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
[bwh: Backported to 3.2: keep maxnodemem_mb as long]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/tile/kernel/setup.c

index bf3e71a..b737c93 100644 (file)
@@ -119,7 +119,8 @@ early_param("maxmem", setup_maxmem);
 static int __init setup_maxnodemem(char *str)
 {
        char *endp;
-       long maxnodemem_mb, node;
+       long maxnodemem_mb;
+       unsigned long node;
 
        node = str ? simple_strtoul(str, &endp, 0) : INT_MAX;
        if (node >= MAX_NUMNODES || *endp != ':' ||