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: <87lhedjqc0.fsf@frog.home>
Date:	Sat, 18 Jul 2015 20:03:27 +0200
From:	Jakub Sitnicki <jsitnicki@...il.com>
To:	Sudip Mukherjee <sudipm.mukherjee@...il.com>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org
Subject: Re: [PATCH 5/6] staging: rtl8188eu: stop using DBG_88E

On Sat, Jul 18, 2015 at 06:46 AM CEST, Sudip Mukherjee <sudipm.mukherjee@...il.com> wrote:
> On Fri, Jul 17, 2015 at 05:33:55PM +0200, Jakub Sitnicki wrote:
>> On Thu, Jul 16, 2015 at 01:28 PM CEST, Sudip Mukherjee <sudipm.mukherjee@...il.com> wrote:
>> > Stop using DBG_88E which is a custom macro for printing debugging
>> > messages. Instead start using pr_debug and in the process define
>> > pr_fmt.
>> 
>> In the end, don't we want to use netdev_dbg() everywhere where we work
>> with a struct net_device? And use dev_dbg() everywhere where we work
>> with a struct device (or a struct usb_interface)?
> Looks like in some places we can get net_device from usb_interface.
>
> struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf);
> struct adapter *padapter = dvobj->if1;
> struct net_device *pnetdev = padapter->pnetdev;

You're right providing that the net_device has been successfully
allocated and hasn't been deallocated yet.  There are at least a couple
of pr_debug() calls that couldn't be converted to netdev_dbg(), one in
rtw_drv_init() and another in rtw_dev_remove(), because the net_device
is not available, if I'm not wrong.

>> At least that's how I understand commit 8f26b8376faa ("checkpatch:
>> update suggested printk conversions") description:
>> 
>>     Direct conversion of printk(KERN_<LEVEL>...  to pr_<level> isn't the
>>     preferred conversion when a struct net_device or struct device is
>>     available.
>> 
>> Do you think it is worth going straight for netdev_dbg()/dev_dbg() to
>> avoid redoing it later?
> At the end it should be netdev_* or dev_* and if both are not available
> then pr_*. Here my main intention was to remove the custom defined
> macro. And while doing this it is easier to use a script to reduce the
> chances of error. Now that the custom macro is out of the way we can
> concentrate on converting it to netdev_* or dev_*.
>> 
>> >
> <snip>
>> >  
>> > +#define pr_fmt(fmt) "R8188EU: " fmt
>> >  #include <osdep_service.h>
>> >  #include <drv_types.h>
>> >  #include <recv_osdep.h>
>> 
>> If we're going to stay with pr_debug(), using KBUILD_MODNAME seems to be
>> the convention among drivers when defining pr_fmt():
>> 
>> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> yes, KBUILD_MODNAME is the usual convention but you will also find many
> places where that has not been used. Here I have used R8188EU to keep it
> same for all the messages that will be printed from the other files of
> this driver else it might be confusing for the user.

I see your point.  If consistent log prefix is the goal do you think it
would make sense to change it to:

#define pr_fmt(fmt) DRIVER_PREFIX ": " fmt

... so the prefix is not defined in two places?

Cheers,
Jakub
--
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