perfmon: fix coverity warning 06/34206/2
authorKlement Sekera <ksekera@cisco.com>
Fri, 22 Oct 2021 11:05:48 +0000 (13:05 +0200)
committerDamjan Marion <dmarion@me.com>
Thu, 28 Oct 2021 10:58:47 +0000 (10:58 +0000)
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

src/plugins/perfmon/intel/uncore.c

index e8939cb..ee3e4ae 100644 (file)
@@ -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);