Skip to contentSkip to conversation

apparmor: avoid -Wempty-body warning

PATCH RESEND In review Arnd Bergmann 2 participants 3 messages Sep 27, 2021

Subsystems (2)

v1 of 2 In review Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 apparmor: avoid -Wempty-body warning

From: Arnd Bergmann <[email protected]>

Building with 'make W=1' shows a warning for an empty macro:

security/apparmor/label.c: In function '__label_update':
security/apparmor/label.c:2096:59: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
2096 | AA_BUG(labels_ns(label) != labels_ns(new));

Change the macro defintion to use no_printk(), which improves format string checking and avoids the warning.

---
I sentn this back in April, and John replied that it's in the apparmor tree, but the fix is still missing as of v5.15-rc2.

Please double-check and re-apply if necessary.

---
 security/apparmor/include/lib.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/include/lib.h +1 -1
index 7d27db740bc2..394130a0f3a4 100644
@@ -36,7 +36,7 @@
 #define AA_BUG_FMT(X, fmt, args...)					\
 	WARN((X), "AppArmor WARN %s: (" #X "): " fmt, __func__, ##args)
 #else
-#define AA_BUG_FMT(X, fmt, args...)
+#define AA_BUG_FMT(X, fmt, args...) no_printk("Apparmor WARN" fmt, ##args)
 #endif
 
 #define AA_ERROR(fmt, args...)						\
Signature · 1 line
2.29.2
maintainer
#1 lore raw
Quoted 2 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Arnd, yep my bad for various reasons I haven't done a merge request since then. I can pickout a set of minor fixes including this and send them up this week.

-
john

Quoted 35 lines

Building with 'make W=1' shows a warning for an empty macro:

security/apparmor/label.c: In function '__label_update':
security/apparmor/label.c:2096:59: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
2096 | AA_BUG(labels_ns(label) != labels_ns(new));

Change the macro defintion to use no_printk(), which improves format string checking and avoids the warning.

---
I sentn this back in April, and John replied that it's in the apparmor tree, but the fix is still missing as of v5.15-rc2.

Please double-check and re-apply if necessary.

---
 security/apparmor/include/lib.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/include/lib.h +1 -1
index 7d27db740bc2..394130a0f3a4 100644
@@ -36,7 +36,7 @@
 #define AA_BUG_FMT(X, fmt, args...)					\
 	WARN((X), "AppArmor WARN %s: (" #X "): " fmt, __func__, ##args)
 #else
-#define AA_BUG_FMT(X, fmt, args...)
+#define AA_BUG_FMT(X, fmt, args...) no_printk("Apparmor WARN" fmt, ##args)
 #endif
 
 #define AA_ERROR(fmt, args...)						\
#2 lore raw
Quoted 6 lines · John Johansen
Quoted 2 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Arnd, yep my bad for various reasons I haven't done a merge request since then.

Ok, no worries. I was just going through my backlog of stuff that is still needed for clean randconfig builds.

Quoted 1 line

I can pickout a set of minor fixes including this and send them up this week.

Thanks!

Arnd