aboutsummaryrefslogtreecommitdiff
path: root/idlestat.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2019-07-10 11:46:11 +0100
committerDaniel Lezcano <daniel.lezcano@linaro.org>2019-07-30 14:43:43 +0200
commit1a07ecf1167df1ebf592d26cd68dcfdf2ca8754a (patch)
tree42097bc33cbac22afd6f4407850a11d7800b6cd0 /idlestat.c
parent4fcc44628ece73277714521f2fc042d126c20e7d (diff)
idlestat: fix number of cpus checkHEADmaster
Currently the a -ve failure value is being handled as an error for the number of CPUs. Also check for zero cpus as this should be considered as invalid. This also stops a zero sized calloc based on zero cpus being reported as an error by static analysis. Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'idlestat.c')
-rw-r--r--idlestat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/idlestat.c b/idlestat.c
index 8c3a01e..96ac38b 100644
--- a/idlestat.c
+++ b/idlestat.c
@@ -360,7 +360,7 @@ static struct init_pstates *build_init_pstates(struct cpu_topology *topo)
unsigned int *freqs;
nrcpus = sysconf(_SC_NPROCESSORS_CONF);
- if (nrcpus < 0)
+ if (nrcpus <= 0)
return NULL;
initp = calloc(sizeof(*initp), 1);