lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 09 Dec 2015 12:52:38 +0100
From:	Arnd Bergmann <arnd@...db.de>
To:	Aaron Conole <aconole@...hat.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, Jason Baron <jbaron@...mai.com>,
	Joe Perches <joe@...ches.com>
Subject: Re: [PATCH v2] printk: help pr_debug and pr_devel to optimize out arguments

On Friday 04 December 2015 16:51:42 Aaron Conole wrote:
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -106,13 +106,14 @@ struct va_format {
>  
>  /*
>   * Dummy printk for disabled debugging statements to use whilst maintaining
> - * gcc's format and side-effect checking.
> + * gcc's format checking.
>   */
> -static inline __printf(1, 2)
> -int no_printk(const char *fmt, ...)
> -{
> -       return 0;
> -}
> +#define no_printk(fmt, ...)                    \
> +do {                                           \
> +       if (0) {                                \
> +               printk(fmt, ##__VA_ARGS__);     \
> +       }                                       \
> +} while (0)
>  

This change breaks compiling lib/842/, at least in some configurations:

lib/842/842_decompress.c: In function '__do_index':
lib/842/842_decompress.c:205:12422: error: implicit declaration of function 'no_printk'

Using a gcc style vararg macro instead of the C99 style makes it work, but
I don't know why the original version didn't work.

Signed-off-by: Arnd Bergmann <arnd@...db.de>

diff --git a/include/linux/printk.h b/include/linux/printk.h
index cc3803a8f73e..4d1851a82254 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -108,10 +108,10 @@ struct va_format {
  * Dummy printk for disabled debugging statements to use whilst maintaining
  * gcc's format checking.
  */
-#define no_printk(fmt, ...)			\
+#define no_printk(arg ...)			\
 do {						\
 	if (0) {				\
-		printk(fmt, ##__VA_ARGS__);	\
+		printk(arg);			\
 	}					\
 } while (0)
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ