blob: 16adbd8a690812afb8d7d93d7e44b24695abc8d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
From 7d2639e9c489c34fa9673fcaee8deec46043fbf8 Mon Sep 17 00:00:00 2001
From: Daniel Pielmeier <billie80@users.noreply.github.com>
Date: Sat, 18 Feb 2017 16:55:35 +0100
Subject: [PATCH] Fix SEGV in a CPU hotplug environment #127
---
src/linux.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/linux.cc b/src/linux.cc
index 664ddf5e..63b3ea40 100644
--- a/src/linux.cc
+++ b/src/linux.cc
@@ -900,6 +900,9 @@ int update_stat(void)
} else {
idx = 0;
}
+ if (idx >= info.cpu_count) {
+ continue;
+ }
sscanf(buf, stat_template, &(cpu[idx].cpu_user),
&(cpu[idx].cpu_nice), &(cpu[idx].cpu_system),
&(cpu[idx].cpu_idle), &(cpu[idx].cpu_iowait),
|