From 9592200c487e223e019ce624d63963696b98b72a Mon Sep 17 00:00:00 2001 From: Casper Andersson Date: Mon, 14 Aug 2023 21:45:40 +0200 Subject: [PATCH] Fix bad null check Found by Facebook Infer static analysis tool Signed-off-by: Casper Andersson --- include/libcapmon.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/libcapmon.h b/include/libcapmon.h index a09e630..328a251 100644 --- a/include/libcapmon.h +++ b/include/libcapmon.h @@ -114,9 +114,11 @@ void capmon_destroy(struct capmon *cm); static int OBJ##_init(struct OBJ##_bpf **skel){\ int err;\ \ + if (skel == NULL) \ + return -EINVAL; \ /* Load and verify BPF application */\ *skel = OBJ##_bpf__open();\ - if (!skel) {\ + if (*skel == NULL) {\ ERR("failed to open and load BPF skeleton\n");\ return 1;\ }\