summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Guzik <mjguzik@gmail.com>2025-01-27 21:54:04 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-08-20 18:41:29 +0200
commit5d0140bc8a6b6bf2e8ebbdff764b5cc26a3aded4 (patch)
treef1ad3123b97db2b6002ff9f37ab56edd69f3e4af
parenta0080ff221ccd2cae96cd744bbd67a2e2357e5e9 (diff)
apparmor: use the condition in AA_BUG_FMT even with debug disabled
[ Upstream commit 67e370aa7f968f6a4f3573ed61a77b36d1b26475 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-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 f11a0db7f51d..e83f45e936a7 100644
--- a/security/apparmor/include/lib.h
+++ b/security/apparmor/include/lib.h
@@ -48,7 +48,11 @@ extern struct aa_dfa *stacksplitdfa;
#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
#define AA_ERROR(fmt, args...) \