]> git.sur5r.net Git - u-boot/commitdiff
NAND boot: fix nand_load overlap issue
authorMingkai Hu <Mingkai.hu@freescale.com>
Thu, 30 Jul 2009 09:56:51 +0000 (17:56 +0800)
committerWolfgang Denk <wd@denx.de>
Fri, 21 Aug 2009 20:55:47 +0000 (22:55 +0200)
The code copy data from NAND flash block by block, so when
the data length isn't a whole-number multiple of the block
size, it will overlap the rest space.

Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
nand_spl/nand_boot_fsl_elbc.c

index 0d0c44e1e366d3343b8b5e14bfbe6fbe122f8d20..7f14a6fe458c5dd93b4d88addac669817be63a24 100644 (file)
@@ -120,7 +120,7 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 
                        pos += page_size;
                        offs += page_size;
-               } while (offs & (block_size - 1));
+               } while ((offs & (block_size - 1)) && (pos < uboot_size));
        }
 }