|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From c119700c06b248b1c2a082b40b1a346f58d89da0 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: Philippe De Swert <philippe.deswert@jollamobile.com>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Sun, 28 Sep 2014 18:12:51 +0300
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] bootchart: Do not try to access data for non-existing CPU's
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Cpu's are assigned normally, so starting at 0, so the MAX_CPU index will
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
always be one smaller than the actual number.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Found with Coverity.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/bootchart/store.c | 2 +-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/bootchart/store.c b/src/bootchart/store.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 3099ff1208..9ea1b27de4 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/bootchart/store.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/bootchart/store.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -199,7 +199,7 @@ vmstat_next:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (strstr(key, "cpu")) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
r = safe_atoi((const char*)(key+3), &c);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- if (r < 0 || c > MAXCPUS)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (r < 0 || c > MAXCPUS -1)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/* Oops, we only have room for MAXCPUS data */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
sampledata->runtime[c] = atoll(rt);
|