Skip to content

Commit 67e370a

Browse files
mjguzikjrjohansen
authored andcommitted
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>
1 parent aabbe6f commit 67e370a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • security/apparmor/include

security/apparmor/include/lib.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ do { \
6060
#define AA_BUG_FMT(X, fmt, args...) \
6161
WARN((X), "AppArmor WARN %s: (" #X "): " fmt, __func__, ##args)
6262
#else
63-
#define AA_BUG_FMT(X, fmt, args...) no_printk(fmt, ##args)
63+
#define AA_BUG_FMT(X, fmt, args...) \
64+
do { \
65+
BUILD_BUG_ON_INVALID(X); \
66+
no_printk(fmt, ##args); \
67+
} while (0)
6468
#endif
6569

6670
int aa_parse_debug_params(const char *str);

0 commit comments

Comments
 (0)