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]
Message-ID: <20090310200200.GB3091@redhat.com>
Date:	Tue, 10 Mar 2009 16:02:00 -0400
From:	Jason Baron <jbaron@...hat.com>
To:	Martin Schwidefsky <schwidefsky@...ibm.com>
Cc:	Geert Uytterhoeven <Geert.Uytterhoeven@...ycom.com>,
	Stephen Rothwell <sfr@...b.auug.org.au>,
	Greg KH <greg@...ah.com>, linux-next@...r.kernel.org,
	Greg Banks <gnb@....com>,
	Herbert Xu <herbert@...dor.apana.org.au>,
	Linux Kernel Development <linux-kernel@...r.kernel.org>
Subject: Re: linux-next: driver-core tree build failure

On Tue, Mar 10, 2009 at 05:08:41PM +0100, Martin Schwidefsky wrote:
> On Tue, 10 Mar 2009 16:29:50 +0100 (CET)
> Geert Uytterhoeven <Geert.Uytterhoeven@...ycom.com> wrote:
> 
> > > The same could be done with the problematic pr_fmt definition:
> > > 
> > > #define pr_fmt(fmt)     __func__ ": " fmt
> > 
> > No, that also doesn't work:
> > 
> > | crypto/zlib.c:150: error: expected '}' before string constant
> > | crypto/zlib.c:150: error: expected ')' before '__func__'
> > | crypto/zlib.c:162: error: expected '}' before string constant
> > | crypto/zlib.c:162: error: expected ')' before '__func__'
> > | crypto/zlib.c:166: error: expected '}' before string constant
> > | crypto/zlib.c:166: error: expected ')' before '__func__'
> > | crypto/zlib.c:170: error: expected '}' before string constant
> > | crypto/zlib.c:170: error: expected ')' before '__func__'
> > 
> > > > BTW, Martin: Is `#define pr_fmt(fmt)     "%s: " fmt, __func__' a valid and
> > > > intended usage of your pr_fmt() infrastructure?
> > > 
> > > The indended use is a simple prefix to the format string. To paste an
> > > additional parameter is an interesting use of the pr_fmt macro ..
> > 
> > Bummer, I was so happy I could do things like
> > 
> > | #define pr_fmt(fmt)	"%s:%u: " fmt, __func__, __LINE__
> 
> Actually that seem like a nice thing to have. With the upstream version of
> dynamic_pr_debug this works, there the format string is used only on a printk.
> git commit 25b67b75587d43ff3f09ad88c03c70a38372d95d introduces the code
> that pastes the format string to the _ddebug structure.
> 

hmmm...yeah, some macro magic in include/linux/dynamic_debug.h converts
the 'fmt' arg into a series of strings. It doesn't look as pretty in the
dynamic debug control file:

crypto/zlib.c:333 [zlib]zlib_decompress_final - "\042%s: \042
\042avail_in %u, avail_out %u (consumed %u, produced %u)\n\042,
__func__"

with all those '\042' there, which are the '"' characters, but we
probably could live with it.

patch below.

thanks,

-Jason



Signed-off-by: Jason Baron <jbaron@...hat.com>


diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 07781aa..16cf212 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -50,28 +50,30 @@ extern int ddebug_remove_module(char *mod_name);
 					__ret = 1;			     \
 	__ret; })
 
-#define dynamic_pr_debug(fmt, ...) do {					\
-	static struct _ddebug descriptor				\
-	__used								\
-	__attribute__((section("__verbose"), aligned(8))) =		\
-	{ KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH,	\
-		DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT };	\
-	if (__dynamic_dbg_enabled(descriptor))				\
-		printk(KERN_DEBUG KBUILD_MODNAME ":" fmt,		\
-				##__VA_ARGS__);				\
+#define STRINGIFY(args...) #args
+
+#define dynamic_pr_debug(fmt, ...) do {					  \
+	static struct _ddebug descriptor				  \
+	__used								  \
+	__attribute__((section("__verbose"), aligned(8))) =		  \
+	{ KBUILD_MODNAME, __func__, __FILE__, STRINGIFY(fmt), DEBUG_HASH, \
+		DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT };	  \
+	if (__dynamic_dbg_enabled(descriptor))				  \
+		printk(KERN_DEBUG KBUILD_MODNAME ":" fmt,		  \
+				##__VA_ARGS__);				  \
 	} while (0)
 
 
-#define dynamic_dev_dbg(dev, fmt, ...) do {				\
-	static struct _ddebug descriptor				\
-	__used								\
-	__attribute__((section("__verbose"), aligned(8))) =		\
-	{ KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH,	\
-		DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT };	\
-	if (__dynamic_dbg_enabled(descriptor))				\
-			dev_printk(KERN_DEBUG, dev,			\
-					KBUILD_MODNAME ": " fmt,	\
-					##__VA_ARGS__);			\
+#define dynamic_dev_dbg(dev, fmt, ...) do {				  \
+	static struct _ddebug descriptor				  \
+	__used								  \
+	__attribute__((section("__verbose"), aligned(8))) =		  \
+	{ KBUILD_MODNAME, __func__, __FILE__, STRINGIFY(fmt), DEBUG_HASH, \
+		DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT };	  \
+	if (__dynamic_dbg_enabled(descriptor))				  \
+			dev_printk(KERN_DEBUG, dev,			  \
+					KBUILD_MODNAME ": " fmt,	  \
+					##__VA_ARGS__);			  \
 	} while (0)
 
 #else




--
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