From 41d6c53d7f72e279ac5b0e6490a5be37e460c4c0 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 26 Nov 2020 15:38:19 -0500 Subject: [PATCH] Fix: libcounter bad compare Identified by Coverity. >>> CID 1437325: Incorrect expression (BAD_COMPARE) >>> Comparing pointer "counter_cpu_fds" against "NULL" using anything besides "==" or "!=" is likely to be incorrect. Signed-off-by: Mathieu Desnoyers Change-Id: I0d21112a0266d67fafde7a6b81e0062a7a43dce0 --- libcounter/counter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcounter/counter.c b/libcounter/counter.c index 640705d3..91506faf 100644 --- a/libcounter/counter.c +++ b/libcounter/counter.c @@ -188,7 +188,7 @@ int validate_args(const struct lib_counter_config *config, return -1; if (!(config->alloc & COUNTER_ALLOC_PER_CPU) && counter_cpu_fds) return -1; - if (!(config->alloc & COUNTER_ALLOC_PER_CPU) && counter_cpu_fds >= 0) + if (!(config->alloc & COUNTER_ALLOC_PER_CPU) && nr_counter_cpu_fds >= 0) return -1; if (counter_cpu_fds && nr_cpus != nr_counter_cpu_fds) return -1; -- 2.34.1