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:	Fri, 18 Apr 2014 21:06:53 -0700
From:	Joe Perches <joe@...ches.com>
To:	Zi Shen Lim <zlim.lnx@...il.com>
Cc:	Nicolas Pitre <nico@...xnic.net>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] smc91x: fix compile error when SMC_DEBUG >= 2

On Fri, 2014-04-18 at 20:47 -0700, Zi Shen Lim wrote:
> When SMC_DEBUG >= 2, we hit the following compilation error:
> 
> drivers/net/ethernet/smsc/smc91x.c:85:0:
> drivers/net/ethernet/smsc/smc91x.c: In function ‘smc_findirq’:
> drivers/net/ethernet/smsc/smc91x.c:1784:9: error: ‘dev’ undeclared (first use in this function)
>   DBG(2, dev, "%s: %s\n", CARDNAME, __func__);
>          ^
> Fix it by passing in the appropriate netdev pointer.

Perhaps verifying the format and args in all cases
would help avoid more of these in the future.
---
 drivers/net/ethernet/smsc/smc91x.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c
index d1b4dca..a8302f5 100644
--- a/drivers/net/ethernet/smsc/smc91x.c
+++ b/drivers/net/ethernet/smsc/smc91x.c
@@ -148,16 +148,19 @@ MODULE_ALIAS("platform:smc91x");
 #define MII_DELAY		1
 
 #if SMC_DEBUG > 0
-#define DBG(n, dev, args...)				\
-	do {						\
-		if (SMC_DEBUG >= (n))			\
-			netdev_dbg(dev, args);		\
-	} while (0)
-
-#define PRINTK(dev, args...)   netdev_info(dev, args)
+#define DBG(n, dev, fmt, ...)					\
+do {								\
+	if (SMC_DEBUG >= (n))					\
+		netdev_dbg(dev, fmt, ##__VA_ARGS__);		\
+} while (0)
+#define PRINTK(dev, fmt, ...)   netdev_info(dev, fmt, ##__VA_ARGS__)
 #else
-#define DBG(n, dev, args...)   do { } while (0)
-#define PRINTK(dev, args...)   netdev_dbg(dev, args)
+#define DBG(n, dev, fmt, ...)					\
+do {								\
+	if (0)					\
+		netdev_dbg(dev, fmt, ##__VA_ARGS__);		\
+} while (0)
+#define PRINTK(dev, fmt, ...)   netdev_dbg(dev, fmt, ##__VA_ARGS__)
 #endif
 
 #if SMC_DEBUG > 3
@@ -191,7 +194,9 @@ static void PRINT_PKT(u_char *buf, int length)
 	pr_cont("\n");
 }
 #else
-#define PRINT_PKT(x...)  do { } while (0)
+static inline void PRINT_PKT(u_char *buf, int length)
+{
+}
 #endif
 
 


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ