summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/nand_util.c
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2009-12-09 09:01:43 +0100
committerScott Wood <scottwood@freescale.com>2009-12-11 13:11:57 -0600
commitf4cfe42758192d09f8375e384cc000aa70d97029 (patch)
tree7b117233a8013dbb90db35cc9ed683d877a858cd /drivers/mtd/nand/nand_util.c
parent3b887ca8ce72cc12129183538f6e828db13f4867 (diff)
downloadu-boot-imx-f4cfe42758192d09f8375e384cc000aa70d97029.zip
u-boot-imx-f4cfe42758192d09f8375e384cc000aa70d97029.tar.gz
u-boot-imx-f4cfe42758192d09f8375e384cc000aa70d97029.tar.bz2
nand: Fix access to last block in NAND devices
Currently, the last block of NAND devices can't be accessed. This patch fixes this issue by correcting the boundary checking (off-by-one error). Signed-off-by: Stefan Roese <sr@denx.de> Cc: Scott Wood <scottwood@freescale.com> Cc: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'drivers/mtd/nand/nand_util.c')
-rw-r--r--drivers/mtd/nand/nand_util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
index 7085d42..61bf7e6 100644
--- a/drivers/mtd/nand/nand_util.c
+++ b/drivers/mtd/nand/nand_util.c
@@ -490,7 +490,7 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
len_incl_bad = get_len_incl_bad (nand, offset, *length);
- if ((offset + len_incl_bad) >= nand->size) {
+ if ((offset + len_incl_bad) > nand->size) {
printf ("Attempt to write outside the flash area\n");
return -EINVAL;
}
@@ -562,7 +562,7 @@ int nand_read_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
len_incl_bad = get_len_incl_bad (nand, offset, *length);
- if ((offset + len_incl_bad) >= nand->size) {
+ if ((offset + len_incl_bad) > nand->size) {
printf ("Attempt to read outside the flash area\n");
return -EINVAL;
}