summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2021-10-22 13:05:48 +0200
committerDamjan Marion <dmarion@me.com>2021-10-28 10:58:47 +0000
commit5d8072c059eda181b54d5ad425abc6f8edaf2a31 (patch)
treed40b9562cb36203dc868f9021d803545002e067c
parent9f4e5d8e512e1d41b8735c1227282d713f50466d (diff)
perfmon: fix coverity warning
Check that cpumask is initialised properly to avoid possible NULL pointer dereference. Type: fix Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: I8df5a718104fe703d6baf3f1294b4a6d2ca01619
-rw-r--r--src/plugins/perfmon/intel/uncore.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/perfmon/intel/uncore.c b/src/plugins/perfmon/intel/uncore.c
index e8939cb67c9..ee3e4aea630 100644
--- a/src/plugins/perfmon/intel/uncore.c
+++ b/src/plugins/perfmon/intel/uncore.c
@@ -132,6 +132,14 @@ intel_uncore_init (vlib_main_t *vm, perfmon_source_t *src)
goto done;
}
+ if (!cpumask)
+ {
+ clib_error_free (err);
+ err = clib_error_return (
+ 0, "while discovering numa topology: cpumask unexpectedly NULL");
+ goto done;
+ }
+
clib_bitmap_foreach (j, cpumask)
{
vec_validate_init_empty (numa_by_cpu_id, j, -1);