From: Sebastien GODARD Date: Sat, 11 Mar 2017 08:38:51 +0000 (+0100) Subject: mpstat: Small additional check X-Git-Tag: v11.5.6~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b6f0c6ea70b8142593b5fbf94ce587b2c87f4b32;p=sysstat mpstat: Small additional check Make sure node number is not negative. Signed-off-by: Sebastien GODARD --- diff --git a/mpstat.c b/mpstat.c index cfd9296..ed6ec16 100644 --- a/mpstat.c +++ b/mpstat.c @@ -300,7 +300,7 @@ int get_node_placement(int cpu_nr, int cpu_per_node[], int cpu2node[]) if (!strncmp(drd->d_name, "node", 4) && isdigit(drd->d_name[4])) { node = atoi(drd->d_name + 4); - if (node >= cpu_nr) { + if ((node >= cpu_nr) || (node < 0)) { /* Assume we cannot have more nodes than CPU */ closedir(dir); return -1;