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]
Date:	Thu, 04 Jul 2013 08:21:59 +0100
From:	Florian Fainelli <florian@...nwrt.org>
To:	Sourav Poddar <sourav.poddar@...com>
Cc:	artem.bityutskiy@...ux.intel.com, linux-mtd@...ts.infradead.org,
	David Woodhouse <dwmw2@...radead.org>, manonuevo@...ron.com,
	tqnguyen@...ron.com, balbi@...com, rnayak@...com,
	linux-omap@...r.kernel.org,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCHv2] drivers: mtd: spinand: Add generic spinand frameowrk.

Hello,

Le jeudi 4 juillet 2013 10:13:43 Sourav Poddar a écrit :
> > 
> > Can this somehow be made a runtime thing?
> 
> Ahh..I think we might opt for a device tree entry and based on that
> check for ECC.

Ok, sounds good too.

> 
> > [snip]
> > 
> >> +               if (count<  oob_num&&  ops->oobbuf&&  chip->oobbuf) {
> >> +                       int size;
> >> +                       int offset, len, temp;
> >> +
> >> +                       /* repack spare to oob */
> >> +                       memset(chip->oobbuf, 0,
> >> info->ecclayout->oobavail);
> >> +
> >> +                       temp = 0;
> >> +                       offset = info->ecclayout->oobfree[0].offset;
> >> +                       len = info->ecclayout->oobfree[0].length;
> >> +                       memcpy(chip->oobbuf + temp,
> >> +                               chip->buf + info->page_main_size +
> >> offset, len);> 
> > Sounds like a for look might be useful here
> 
> I dont think so, there is a while loop above under which it happens.
> We are increasing count at the bottom of the while loop. So, I think
> this should work fine.

What I meant here, is that you could use a for loop to repeat 4 times the same 
following pattern, such that it becomes:

for (j = 0; j < 4; j++0 {
	temp += len;
	offset = info->ecclayout->oobfree[j].offset;
	len = info->ecclayout->oobfree[j].length;
	memcpy(chip->oobbuf + temp,
		chip->buf + info->page_main_size + offset, len);
}

Or even make it a helper function which is inlined if that is deemed more 
elegant.
-- 
Florian
--
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