Skip to contentSkip to conversation

tile: array underflow in setup_maxnodemem()

PATCH In review Dan Carpenter 2 participants 2 messages Jul 22, 2017 – Jul 24, 2017 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tile: array underflow in setup_maxnodemem()

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.")
arch/tile/kernel/setup.c +1 -1
index 443a70bccc1c..b1474e7d9afb 100644
@@ -140,7 +140,7 @@ static int __init setup_maxnodemem(char *str)
 {
 	char *endp;
 	unsigned long long maxnodemem;
-	long node;
+	unsigned long node;
 
 	node = str ? simple_strtoul(str, &endp, 0) : INT_MAX;
 	if (node >= MAX_NUMNODES || *endp != ':')
#1 lore raw
Quoted 5 lines · Dan Carpenter

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.")

Thanks, taken into the tile tree.

Signature · 2 lines
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com