Patchwork nanddump: fix initialization of bad blocks oob data buffer

login
register
mail settings
Submitter Baruch Siach
Date Oct. 11, 2010, 9:19 a.m.
Message ID <0870ac8ab250ec91dceb2cc461fe82c0d7995bc8.1286788714.git.baruch@tkos.co.il>
Download mbox | patch
Permalink /patch/67398/
State New
Headers show

Comments

Baruch Siach - Oct. 11, 2010, 9:19 a.m.
When dumping oob data of a bad block, initialize oobbuf with 0xff, instead of
readbuf.  This avoids bogus oob data on output.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 nanddump.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Mike Frysinger - Oct. 11, 2010, 5:07 p.m.
On Mon, Oct 11, 2010 at 05:19, Baruch Siach wrote:
> When dumping oob data of a bad block, initialize oobbuf with 0xff, instead of
> readbuf.  This avoids bogus oob data on output.
>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike
Artem Bityutskiy - Oct. 12, 2010, 10:02 a.m.
On Mon, 2010-10-11 at 11:19 +0200, Baruch Siach wrote:
> When dumping oob data of a bad block, initialize oobbuf with 0xff, instead of
> readbuf.  This avoids bogus oob data on output.
> 
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>  nanddump.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/nanddump.c b/nanddump.c
> index 3589931..0fdf736 100644
> --- a/nanddump.c
> +++ b/nanddump.c
> @@ -452,7 +452,7 @@ int main(int argc, char * const argv[])
>  			continue;
>  
>  		if (badblock) {
> -			memset (readbuf, 0xff, meminfo.oobsize);
> +			memset (oobbuf, 0xff, meminfo.oobsize);
Removed junk white-space
>  		} else {
>  			/* Read OOB data and exit on failure */
>  			oob.start = ofs;

and push to mtd-utils.git, thanks!

Patch

diff --git a/nanddump.c b/nanddump.c
index 3589931..0fdf736 100644
--- a/nanddump.c
+++ b/nanddump.c
@@ -452,7 +452,7 @@  int main(int argc, char * const argv[])
 			continue;
 
 		if (badblock) {
-			memset (readbuf, 0xff, meminfo.oobsize);
+			memset (oobbuf, 0xff, meminfo.oobsize);
 		} else {
 			/* Read OOB data and exit on failure */
 			oob.start = ofs;