From 617c67a039b25139e5516aa48931c7024c6f8dc5 Mon Sep 17 00:00:00 2001 From: Julia Kartseva Date: Sun, 9 Jan 2022 21:35:35 -0800 Subject: [PATCH] bpf: fix bpf_can_link_lsm_program condition Since bpf_can_link_lsm_program return value is boolean, the expression `r < 0` is always false. (cherry picked from commit ccfc534deed2f3873c967851497af10d8a1ee01c) --- src/core/bpf-lsm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/bpf-lsm.c b/src/core/bpf-lsm.c index 4ca082a005..83f3199349 100644 --- a/src/core/bpf-lsm.c +++ b/src/core/bpf-lsm.c @@ -167,9 +167,9 @@ int lsm_bpf_supported(void) { if (r < 0) return supported = 0; - r = bpf_can_link_lsm_program(obj->progs.restrict_filesystems); - if (r < 0) { - log_warning_errno(r, "Failed to link BPF program. Assuming BPF is not available: %m"); + if (!bpf_can_link_lsm_program(obj->progs.restrict_filesystems)) { + log_warning_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), + "Failed to link BPF program. Assuming BPF is not available"); return supported = 0; }