Linux-Security-Module Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] apparmor: avoid -Wempty-body warning
@ 2021-03-22 11:00 Arnd Bergmann
  2021-04-03 18:26 ` John Johansen
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2021-03-22 11:00 UTC (permalink / raw)
  To: John Johansen, James Morris, Serge E. Hallyn
  Cc: Arnd Bergmann, linux-security-module, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 security/apparmor/include/lib.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/apparmor/include/lib.h b/security/apparmor/include/lib.h
index 7d27db740bc2..67fbb81a11f3 100644
--- a/security/apparmor/include/lib.h
+++ b/security/apparmor/include/lib.h
@@ -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(fmt, ##args)
 #endif
 
 #define AA_ERROR(fmt, args...)						\
-- 
2.29.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] apparmor: avoid -Wempty-body warning
  2021-03-22 11:00 [PATCH] apparmor: avoid -Wempty-body warning Arnd Bergmann
@ 2021-04-03 18:26 ` John Johansen
  0 siblings, 0 replies; 2+ messages in thread
From: John Johansen @ 2021-04-03 18:26 UTC (permalink / raw)
  To: Arnd Bergmann, James Morris, Serge E. Hallyn
  Cc: Arnd Bergmann, linux-security-module, linux-kernel

On 3/22/21 4:00 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Aked-by: John Johansen <john.johansen@canonical.com>

I have pulled it into the apparmor tree

> ---
>  security/apparmor/include/lib.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/security/apparmor/include/lib.h b/security/apparmor/include/lib.h
> index 7d27db740bc2..67fbb81a11f3 100644
> --- a/security/apparmor/include/lib.h
> +++ b/security/apparmor/include/lib.h
> @@ -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(fmt, ##args)
>  #endif
>  
>  #define AA_ERROR(fmt, args...)						\
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 11:00 [PATCH] apparmor: avoid -Wempty-body warning Arnd Bergmann
2021-04-03 18:26 ` John Johansen

Linux-Security-Module Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-security-module/0 linux-security-module/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-security-module linux-security-module/ https://lore.kernel.org/linux-security-module \
		linux-security-module@vger.kernel.org
	public-inbox-index linux-security-module

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-security-module


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git