]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
apparmor: use the condition in AA_BUG_FMT even with debug disabled
authorMateusz Guzik <mjguzik@gmail.com>
Mon, 27 Jan 2025 20:54:04 +0000 (21:54 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Aug 2025 16:41:29 +0000 (18:41 +0200)
[ 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>
security/apparmor/include/lib.h

index f11a0db7f51da4b84045dc082839bd66cda21016..e83f45e936a7d44f8a1f420f85b619ecdb83b5a6 100644 (file)
@@ -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...)                                         \