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]
Message-ID: <20210428094733.GA1427@agape.jhs>
Date:   Wed, 28 Apr 2021 11:47:34 +0200
From:   Fabio Aiuto <fabioaiuto83@...il.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Joe Perches <joe@...ches.com>, gregkh@...uxfoundation.org,
        linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 02/49] staging: rtl8723bs: replace DBG_871X_SEL log macro
 with netdev_dbg()

On Wed, Apr 28, 2021 at 12:28:42PM +0300, Dan Carpenter wrote:
> On Fri, Apr 23, 2021 at 06:52:49PM +0200, Fabio Aiuto wrote:
> > On Fri, Apr 23, 2021 at 08:27:58AM -0700, Joe Perches wrote:
> > > On Fri, 2021-04-23 at 16:57 +0200, Fabio Aiuto wrote:
> > > > replace DBG_871X_SEL log macro with the net device driver
> > > > recommended netdev_dbg().
> > > > 
> > > > This macro by default does a raw printk, and the alternative
> > > > behaviour, never triggered is a seq_print() call.
> > > []
> > > > diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c b/drivers/staging/rtl8723bs/core/rtw_debug.c
> > > []
> > > > @@ -23,9 +23,10 @@ void mac_reg_dump(void *sel, struct adapter *adapter)
> > > >  	for (i = 0x0; i < 0x800; i += 4) {
> > > >  		if (j%4 == 1)
> > > >  			netdev_dbg(adapter->pnetdev, "0x%03x", i);
> > > > -		DBG_871X_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
> > > > +		netdev_dbg(adapter->pnetdev, " 0x%08x ",
> > > > +			   rtw_read32(adapter, i));
> > > >  		if ((j++)%4 == 0)
> > > > -			DBG_871X_SEL(sel, "\n");
> > > > +			netdev_dbg(adapter->pnetdev, "\n");
> > > >  	}
> > > 
> > > This makes a mess of the output as each netdev_dbg call
> > > is a separate line.
> > > 
> > > Dumping 1000 register lines into output logs seems impolite
> > > at best, even for debugging.
> > > 
> > > This _might_ be rewritten to something like:
> > > 
> > > void dump_4_regs(struct adapter *adapter, int offset)
> > > {
> > > 	u32 reg[4];
> > > 	int i;
> > > 
> > > 	for (i = 0; i < 4; i++)
> > > 		reg[i] = rtw_read32(adapter, offset + i);
> > > 
> > > 	netdev_dbg(adapter->pnetdev, "0x%03x 0x%08x 0x%08x 0x%08x 0x%08x\n",
> > > 		   i, reg[0], reg[1], reg[2], reg[3]);
> > > }
> > > 
> > > void mac_reg_dump(...)
> > > {
> > > 	...
> > > 
> > > 	for (i = 0; i < 0x800; i += 4)
> > > 		dump_4_regs(adapter, i);
> > > 
> > > 
> > > 
> > 
> > interesting, sure that will be matter of another patch series,
> > the ugly output was already there, old macro used to wrap a raw
> > printk...
> 
> The raw printk doesn't automatically add a new line at the end but a
> netdev_dbg() does.  (You're still supposed to add a manual \n to those
> but if you don't the lower layers will do it automatically.)
> 
> regards,
> dan carpenter

got it,

thank you,

fabio

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ