[PATCH 7/8] mtd: nand_bbt: use string library
Shmulik Ladkani
shmulik.ladkani at gmail.com
Tue Jun 26 09:37:38 EDT 2012
Hi Brian,
On Fri, 22 Jun 2012 16:35:44 -0700 Brian Norris <computersforpeace at gmail.com> wrote:
> static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_descr *td)
> {
> - int i, end = 0;
> + int end = 0;
> uint8_t *p = buf;
>
> if (td->options & NAND_BBT_NO_OOB)
> return check_pattern_no_oob(buf, td);
>
> end = paglen + td->offs;
> - if (td->options & NAND_BBT_SCANEMPTY) {
> - for (i = 0; i < end; i++) {
> - if (p[i] != 0xff)
> - return -1;
> - }
> - }
> + if (td->options & NAND_BBT_SCANEMPTY)
> + if (memchr_inv(p, 0xff, end))
> + return -1;
> p += end;
>
A question regarding the original code:
Why the region validated for 0xff is [0 , paglen+td->of) ?
I assume this buffer region contains the inband data. Why verify inband
data is all 0xff?
Shouldn't the region validated be [paglen , paglen+td->of) ?
Regards,
Shmulik
More information about the linux-mtd
mailing list