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] [day] [month] [year] [list]
Date:	Tue, 09 Jun 2015 16:30:39 -0700
From:	Joe Perches <joe@...ches.com>
To:	Mauro Carvalho Chehab <mchehab@....samsung.com>
Cc:	Malcolm Priestley <tvboxspy@...il.com>,
	linux-media@...r.kernel.org,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] [media] lmedm04: Neaten logging

On Tue, 2015-06-09 at 19:07 -0300, Mauro Carvalho Chehab wrote:
> Hi Joe,

Marhaba Mauro.

> Em Mon, 25 May 2015 01:29:07 -0700
> Joe Perches <joe@...ches.com> escreveu:
> 
> > Use a more current logging style.
> > 
> > o Use pr_fmt
> > o Add missing newlines to formats
> > o Remove used-once lme_debug macro incorporating it into dbg_info
> > o Remove unnecessary allocation error messages
> > o Remove unnecessary semicolons from #defines
> > o Remove info macro and convert uses to pr_info
> > o Fix spelling of snippet
> > o Use %phN extension
> 
> There are a few checkpatch warnings:

I hardly use checkpatch tbh

The long lines I don't care about, I presume all the others are
existing, but I'll run --fix on it and resubmit if you want.

> > diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
[]
> >  /* debug */
> >  static int dvb_usb_lme2510_debug;
> > -#define lme_debug(var, level, args...) do { \
> > -	if ((var >= level)) \
> > -		pr_debug(DVB_USB_LOG_PREFIX": " args); \
> > +#define deb_info(level, fmt, ...)					\
> > +do {									\
> > +	if (dvb_usb_lme2510_debug >= level)				\
> > +		pr_debug(fmt, ##__VA_ARGS__);				\
> >  } while (0)
> 
> 
> The usage of both a debug level and pr_debug() is not nice, as,
> if CONFIG_DYNAMIC_DEBUG is enabled (with is the case on most distros),
> one needing to debug would need to both pass a debug level AND to enable
> the debug line via sysfs, with is not nice.

> We might of course remove debug levels as a hole and just use 
> pr_debug(), but the end result is generally worse (didn't chec
> the specifics on this file).
> 
> So, the better here would be to use printk like:
> 
> #define deb_info(level, fmt, ...)\
> 	do { if (dvb_usb_lme2510_debug >= level)\
> 		printk(KERN_DEBUG pr_fmt(fmt), ## arg);\
> 	} while (0)
> 
> Ok, this issue were already present on the old code, but IMHO the
> best is to either use the above definition of deb_info() or to just
> call pr_debug() and get rid of dvb_usb_lme2510_debug.

Alternately, you could #define DEBUG and these would be enabled
by default for CONFIG_DYNAMIC_DEBUG and act the same otherwise.


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