diff options
author | Colin Ian King <colin.king@canonical.com> | 2019-07-10 11:46:11 +0100 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2019-07-30 14:43:43 +0200 |
commit | 1a07ecf1167df1ebf592d26cd68dcfdf2ca8754a (patch) | |
tree | 42097bc33cbac22afd6f4407850a11d7800b6cd0 /idlestat.c | |
parent | 4fcc44628ece73277714521f2fc042d126c20e7d (diff) |
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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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); |