bootchart: Do not try to access data for non-existing CPU's

Cpu's are assigned normally, so starting at 0, so the MAX_CPU index will
always be one smaller than the actual number.

Found with Coverity.
This commit is contained in:
Philippe De Swert
2014-09-28 19:35:11 +02:00
committed by Thomas Hindoe Paaboel Andersen
parent 5e90b6a978
commit c119700c06
+1 -1
View File
@@ -199,7 +199,7 @@ vmstat_next:
if (strstr(key, "cpu")) {
r = safe_atoi((const char*)(key+3), &c);
if (r < 0 || c > MAXCPUS)
if (r < 0 || c > MAXCPUS -1)
/* Oops, we only have room for MAXCPUS data */
break;
sampledata->runtime[c] = atoll(rt);