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: <ygfmytfbubd.fsf@janus.isnogud.escape.de>
Date:	15 Nov 2007 12:51:34 +0100
From:	Urs Thuermann <urs.thuermann@....de>
To:	Joe Perches <joe@...ches.com>
Cc:	Oliver Hartkopp <oliver@...tkopp.net>,
	Stephen Hemminger <shemminger@...ux-foundation.org>,
	netdev@...r.kernel.org, David Miller <davem@...emloft.net>,
	Patrick McHardy <kaber@...sh.net>,
	Oliver Hartkopp <oliver.hartkopp@...kswagen.de>
Subject: Re: [PATCH 2/7] CAN: Add PF_CAN core module

Joe Perches <joe@...ches.com> writes:

> On Thu, 2007-11-15 at 08:40 +0100, Oliver Hartkopp wrote:
> > Stephen Hemminger wrote:
> > >> +#ifdef CONFIG_CAN_DEBUG_CORE
> > >> +extern void can_debug_skb(struct sk_buff *skb);
> > >> +extern void can_debug_cframe(const char *msg, struct can_frame *cframe);
> > >> +#define DBG(fmt, args...)  (DBG_VAR & 1 ? printk( \
> > >> +					KERN_DEBUG DBG_PREFIX ": %s: " fmt, \
> > >> +					__func__, ##args) : 0)
> > >> +#define DBG_FRAME(fmt, cf) (DBG_VAR & 2 ? can_debug_cframe(fmt, cf) : 0)
> > >> +#define DBG_SKB(skb)       (DBG_VAR & 4 ? can_debug_skb(skb) : 0)
> > >> +#else
> > >> +#define DBG(fmt, args...)
> > >> +#define DBG_FRAME(fmt, cf)
> > >> +#define DBG_SKB(skb)
> > >> +#endif
> 
> I would prefer the more frequently used macro style:
> 
> #define DBG(fmt, args...) \
> 	do { if (DBG_VAR & 1) printk(KERN_DEBUG DBG_PREFIX ": %s: " fmt, \
> 				     __func__, ##args); } while (0)
> 
> #define DBG_FRAME(fmt, cf) \
> 	do { if (DBG_VAR & 2) can_debug_cframe(fmt, cf); } while (0)
> 
> #define DBG_SKB(skb) \
> 	do { if (DBG_VAR & 4) can_debug_skb(skb); } while (0)

I prefer our code because it is shorter (fits into one line) and can
be used anywhere where an expression is allowed compared to only where
a statement is allowed.  Actually, I first had

        #define DBG( ... )   ((debug & 1) && printk( ... ))

and so on, but that didn't work with can_debug_{cframe,sbk} since they
return void.

Admitted, the benefit of expr vs. statement is really negligible and
since this issue has come up several times I will change these macros
using do-while.

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