summaryrefslogtreecommitdiffstats
path: root/src/plugins/perfmon
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2021-11-16 12:32:59 +0100
committerOle Tr�an <otroan@employees.org>2021-11-16 16:19:40 +0000
commitcbc81eae6ef62ea14bce06e8bdc2017139882e8b (patch)
tree48f2da72209e31a536310c64041d9fb65ae50fcf /src/plugins/perfmon
parentfc283bc0403d1c26d130c4332f3ac317d3734cda (diff)
perfmon: fix coverity warning
Check for possible hash lookup failure to avoid NULL dereference. Type: fix Fixes: e15c999c30 Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: Ib806b4d124be26fbccf36fe9d19af1aec63f487b
Diffstat (limited to 'src/plugins/perfmon')
-rw-r--r--src/plugins/perfmon/intel/bundle/iio_bw.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/plugins/perfmon/intel/bundle/iio_bw.c b/src/plugins/perfmon/intel/bundle/iio_bw.c
index 9aaca42233f..66c550ff9c2 100644
--- a/src/plugins/perfmon/intel/bundle/iio_bw.c
+++ b/src/plugins/perfmon/intel/bundle/iio_bw.c
@@ -126,9 +126,16 @@ format_stack_socket (u8 *s, va_list *va)
}
uword *pu = hash_get (h, root_bus.bus);
- e = pool_elt_at_index (p, (index_t) pu[0]);
+ if (pu)
+ {
+ e = pool_elt_at_index (p, (index_t) pu[0]);
- s = format (s, "IIO%u/%u", e->socket_id, e->iio_unit_id);
+ s = format (s, "IIO%u/%u", e->socket_id, e->iio_unit_id);
+ }
+ else
+ {
+ s = format (s, "[ERR: hash lookup for bus '%u' failed]", root_bus.bus);
+ }
return s;
}