[U-Boot] [PATCH] NAND boot: fix nand_load overlap issue

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 --- nand_spl/nand_boot_fsl_elbc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/nand_spl/nand_boot_fsl_elbc.c b/nand_spl/nand_boot_fsl_elbc.c index 0d0c44e..7f14a6f 100644 --- a/nand_spl/nand_boot_fsl_elbc.c +++ b/nand_spl/nand_boot_fsl_elbc.c @@ -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)); } }

Dear Scott,
In message 1244170414-4840-1-git-send-email-Mingkai.hu@freescale.com Mingkai Hu wrote:
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
nand_spl/nand_boot_fsl_elbc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Can you please check the state of this patch? Thanks in advance.
Best regards,
Wolfgang Denk

On Sun, Jul 19, 2009 at 01:23:43AM +0200, Wolfgang Denk wrote:
Dear Scott,
In message 1244170414-4840-1-git-send-email-Mingkai.hu@freescale.com Mingkai Hu wrote:
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
nand_spl/nand_boot_fsl_elbc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Can you please check the state of this patch? Thanks in advance.
Applied to u-boot-nand-flash.
-Scott
participants (3)
-
Mingkai Hu
-
Scott Wood
-
Wolfgang Denk