summaryrefslogtreecommitdiff
path: root/security/apparmor
diff options
context:
space:
mode:
authorMateusz Guzik <mjguzik@gmail.com>2025-01-27 21:54:04 +0100
committerJohn Johansen <john.johansen@canonical.com>2025-02-10 11:17:59 -0800
commit67e370aa7f968f6a4f3573ed61a77b36d1b26475 (patch)
treebe3ee4e0389eccbd147455edec814b1877ba0153 /security/apparmor
parentaabbe6f908d8264cd8aeeef8141665f71668ef36 (diff)
downloadlinux-67e370aa7f968f6a4f3573ed61a77b36d1b26475.tar.gz
linux-67e370aa7f968f6a4f3573ed61a77b36d1b26475.tar.bz2
linux-67e370aa7f968f6a4f3573ed61a77b36d1b26475.zip
apparmor: use the condition in AA_BUG_FMT even with debug disabled
This follows the established practice and fixes a build failure for me: security/apparmor/file.c: In function ‘__file_sock_perm’: security/apparmor/file.c:544:24: error: unused variable ‘sock’ [-Werror=unused-variable] 544 | struct socket *sock = (struct socket *) file->private_data; | ^~~~ Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor')
-rw-r--r--security/apparmor/include/lib.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/security/apparmor/include/lib.h b/security/apparmor/include/lib.h
index 256f4577c653..d947998262b2 100644
--- a/security/apparmor/include/lib.h
+++ b/security/apparmor/include/lib.h
@@ -60,7 +60,11 @@ do { \
#define AA_BUG_FMT(X, fmt, args...) \
WARN((X), "AppArmor WARN %s: (" #X "): " fmt, __func__, ##args)
#else
-#define AA_BUG_FMT(X, fmt, args...) no_printk(fmt, ##args)
+#define AA_BUG_FMT(X, fmt, args...) \
+ do { \
+ BUILD_BUG_ON_INVALID(X); \
+ no_printk(fmt, ##args); \
+ } while (0)
#endif
int aa_parse_debug_params(const char *str);