[BUG] mtd-utils: nandwrite: invalid erase after page write failure

Artem Bityutskiy dedekind1 at gmail.com
Fri Aug 19 13:02:58 EDT 2011


On Thu, 2011-08-11 at 16:30 +0100, Fryar, Jeff wrote:
> mtd-utils nandwrite.c: After a page write failure, the calculation
> of the block number to erase is incorrect.  The erase block size is 
> being passed as the erase block number in the call to mtd_erase().
> 
> Jeff Fryar <jeff.fryar at hp.com>
> 
> 
> --- mtd-utils-f1fe865/nandwrite.c.ORIG  2011-07-20 00:28:52.000000000 -0500
> +++ mtd-utils-f1fe865/nandwrite.c       2011-08-11 09:19:12.000000000 -0500
> @@ -659,7 +659,7 @@
>                         fprintf(stderr, "Erasing failed write from %#08llx to %#08llx\n",
>                                 blockstart, blockstart + ebsize_aligned - 1);
>                         for (i = blockstart; i < blockstart + ebsize_aligned; i += mtd.eb_size) {
> -                               if (mtd_erase(mtd_desc, &mtd, fd, mtd.eb_size)) {
> +                               if (mtd_erase(mtd_desc, &mtd, fd, (i/mtd.eb_size))) {

Looks like correct fix, thanks! Your patch is not very well formatted,
but I've amended it and applied to mtd-utils, thanks!

-- 
Best Regards,
Artem Bityutskiy




More information about the linux-mtd mailing list