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: <20181220150715.5b19f480@bbrezillon>
Date:   Thu, 20 Dec 2018 15:07:26 +0100
From:   Boris Brezillon <bbrezillon@...nel.org>
To:     Schrempf Frieder <frieder.schrempf@...tron.de>
Cc:     "richard@....at" <richard@....at>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Marek Vasut <marek.vasut@...il.com>,
        "linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
        "miquel.raynal@...tlin.com" <miquel.raynal@...tlin.com>,
        Brian Norris <computersforpeace@...il.com>,
        David Woodhouse <dwmw2@...radead.org>
Subject: Re: [PATCH 1/3] mtd: rawnand: Support bad block markers in first,
 second or last page

On Thu, 20 Dec 2018 14:59:54 +0100
Boris Brezillon <boris.brezillon@...tlin.com> wrote:

> >  
> >  /**
> > + * nand_bbm_page_offset - Get the page offsets for bad block markers
> > + * @chip: NAND chip object
> > + * @index: Index for the page offset  
> 
> Hm, the meaning of index is far from obvious. How about passing the
> current page instead (and return 1 if there are more pages to scan 0
> otherwise)?
> 
> Something like:
> 
> static int nand_bbm_get_next_page(struct nand_chip *chip, int page)
> {
> 	struct mtd_info *mtd = nand_to_mtd(chip);
> 	int last_page = ((mtd->erasesize - mtd->writesize) >>
> 			 chip->page_shift) & chip->pagemask;
> 
> 	if (page < 0 && chip->bbt_options & NAND_BBT_SCANFIRSTPAGE)
> 		return 0;
> 	else if (page < 1 && chip->bbt_options & NAND_BBT_SCAN2NDPAGE)
> 		return 1;
> 	else if (page < last_page &&
> 		 chip->bbt_options & NAND_BBT_SCANLASTPAGE)
> 		return last_page;
> 
> 	return -1;
> }
> 
> And yes, that means defining NAND_BBT_SCANFIRSTPAGE and setting it when
> appropriate.
> 

Oh, and you'll have to define NAND_BBT_SCANFIRST2PAGES like this

#define NAND_BBT_SCANFIRST2PAGES NAND_BBT_SCAN1STPAGE |	\
				 NAND_BBT_SCAN2NDPAGE

and then patch all users of NAND_BBT_SCAN2NDPAGE to use
NAND_BBT_SCANFIRST2PAGES instead.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ