summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe De Swert <philippe.deswert@jollamobile.com>2014-09-28 18:12:51 +0300
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>2014-09-28 19:35:11 +0200
commitc119700c06b248b1c2a082b40b1a346f58d89da0 (patch)
tree6ee7276b114ed4e9416ded27b6bdfb6569232bed
parent5e90b6a978d15efedc5b5cc4a3d2d922a0ecd2a9 (diff)
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.
-rw-r--r--src/bootchart/store.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bootchart/store.c b/src/bootchart/store.c
index 3099ff1208..9ea1b27de4 100644
--- a/src/bootchart/store.c
+++ b/src/bootchart/store.c
@@ -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);