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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sun, 9 Oct 2022 12:17:10 +0200
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     Joe Perches <joe@...ches.com>
Cc:     Ray Zhang <sgzhang@...gle.com>,
        Richard Weinberger <richard@....at>,
        Vignesh Raghavendra <vigneshr@...com>,
        linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/3] mtd: mtdoops: change printk() to counterpart pr_
 functions

Hi Joe,

joe@...ches.com wrote on Sat, 08 Oct 2022 00:25:07 -0700:

> On Fri, 2022-10-07 at 21:50 +0000, Ray Zhang wrote:
> > To comply with latest kernel code requirement, change printk() to
> > counterpart pr_ functions in mtdoops driver:
> > - change printk(INFO) to pr_info()
> > - change printk(DEBUG) to pr_debug()
> > - change printk(WARNING) to pr_warn()
> > - change printk(ERR) to pr_err()
> > 
> > Note that only if dynamic debugging is enabled or DEBUG is defined,
> > printk(KERN_DEBUG) and pr_debug() are equivalent; Otherwise pr_debug()
> > is no-op, causing different behavior.  
> 
> Another thing possible is to add
> 
> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> 
> before any #include

Good point.

> > diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c  
> []
> > @@ -93,9 +93,9 @@ static int mtdoops_erase_block(struct mtdoops_context *cxt, int offset)
> >  
> >  	ret = mtd_erase(mtd, &erase);
> >  	if (ret) {
> > -		printk(KERN_WARNING "mtdoops: erase of region [0x%llx, 0x%llx] on \"%s\" failed\n",
> > -		       (unsigned long long)erase.addr,
> > -		       (unsigned long long)erase.len, mtddev);
> > +		pr_warn("mtdoops: erase of region [0x%llx, 0x%llx] on \"%s\" failed\n",
> > +			(unsigned long long)erase.addr,
> > +			(unsigned long long)erase.len, mtddev);  
> 
> And remove the "mtdoops: " prefixes from all the output formats
> 
> 		pr_warn("erase of region [0x%llx, 0x%llx] on \"%s\" failed\n",
> 			(unsigned long long)erase.addr,
> 			(unsigned long long)erase.len, mtddev);
> 
> > @@ -120,8 +120,8 @@ static void mtdoops_inc_counter(struct mtdoops_context *cxt)
> >  		return;
> >  	}
> >  
> > -	printk(KERN_DEBUG "mtdoops: ready %d, %d (no erase)\n",
> > -	       cxt->nextpage, cxt->nextcount);
> > +	pr_debug("mtdoops: ready %d, %d (no erase)\n",
> > +		 cxt->nextpage, cxt->nextcount);  
> 
> 	pr_debug("ready %d, %d (no erase)\n", cxt->nextpage, cxt->nextcount);
> 
> etc...
> 


Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ