projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d0d845a
)
apparmor: fix zero-length compiler warning in AA_BUG()
author
John Johansen
<john.johansen@canonical.com>
Fri, 3 Sep 2021 06:27:31 +0000
(23:27 -0700)
committer
John Johansen
<john.johansen@canonical.com>
Wed, 3 Nov 2021 08:08:15 +0000
(
01:08
-0700)
Uses of AA_BUG() without a message can result in the compiler warning
warning: zero-length gnu_printf format string [-Wformat-zero-length]
Fix this with a pragma for now. A larger rework of AA_BUG() will
follow.
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/include/lib.h
patch
|
blob
|
history
diff --git
a/security/apparmor/include/lib.h
b/security/apparmor/include/lib.h
index 67fbb81a11f3c4414528e6fed1038e7cf7c36276..e2e8df0c6f1c931ce22d5cb21cf84ed08ee72c32 100644
(file)
--- a/
security/apparmor/include/lib.h
+++ b/
security/apparmor/include/lib.h
@@
-31,7
+31,12
@@
#define AA_WARN(X) WARN((X), "APPARMOR WARN %s: %s\n", __func__, #X)
-#define AA_BUG(X, args...) AA_BUG_FMT((X), "" args)
+#define AA_BUG(X, args...) \
+ do { \
+ _Pragma("GCC diagnostic ignored \"-Wformat-zero-length\""); \
+ AA_BUG_FMT((X), "" args); \
+ _Pragma("GCC diagnostic warning \"-Wformat-zero-length\""); \
+ } while (0)
#ifdef CONFIG_SECURITY_APPARMOR_DEBUG_ASSERTS
#define AA_BUG_FMT(X, fmt, args...) \
WARN((X), "AppArmor WARN %s: (" #X "): " fmt, __func__, ##args)