* [U-Boot] [PATCH] Fix computation in nand_util.c:get_len_incl_bad
@ 2009-12-01 13:05 Daniel Hobi
2009-12-01 23:55 ` Scott Wood
2009-12-07 21:38 ` Wolfgang Denk
0 siblings, 2 replies; 4+ messages in thread
From: Daniel Hobi @ 2009-12-01 13:05 UTC (permalink / raw)
To: u-boot
Depending on offset, flash size and the number of bad blocks,
get_len_incl_bad may return a too small value which may lead to:
1) If there are no bad blocks, nand_{read,write}_skip_bad chooses the
bad block aware read/write code. This may hurt performance, but does
not have any adverse effects.
2) If there are bad blocks, the nand_{read,write}_skip_bad may choose
the bad block unaware read/write code (if len_incl_bad == *length)
which leads to corrupted data.
Signed-off-by: Daniel Hobi <daniel.hobi@schmid-telecom.ch>
---
@Scott: please review
@Wolfgang: please consider for 2009.11
diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
index bec9277..7085d42 100644
--- a/drivers/mtd/nand/nand_util.c
+++ b/drivers/mtd/nand/nand_util.c
@@ -452,7 +452,7 @@ static size_t get_len_incl_bad (nand_info_t *nand, loff_t offset,
len_incl_bad += block_len;
offset += block_len;
- if ((offset + len_incl_bad) >= nand->size)
+ if (offset >= nand->size)
break;
}
--
1.5.6.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] Fix computation in nand_util.c:get_len_incl_bad
2009-12-01 13:05 [U-Boot] [PATCH] Fix computation in nand_util.c:get_len_incl_bad Daniel Hobi
@ 2009-12-01 23:55 ` Scott Wood
2009-12-05 0:44 ` Wolfgang Denk
2009-12-07 21:38 ` Wolfgang Denk
1 sibling, 1 reply; 4+ messages in thread
From: Scott Wood @ 2009-12-01 23:55 UTC (permalink / raw)
To: u-boot
On Tue, Dec 01, 2009 at 02:05:55PM +0100, Daniel Hobi wrote:
> Depending on offset, flash size and the number of bad blocks,
> get_len_incl_bad may return a too small value which may lead to:
>
> 1) If there are no bad blocks, nand_{read,write}_skip_bad chooses the
> bad block aware read/write code. This may hurt performance, but does
> not have any adverse effects.
>
> 2) If there are bad blocks, the nand_{read,write}_skip_bad may choose
> the bad block unaware read/write code (if len_incl_bad == *length)
> which leads to corrupted data.
It could also lead to the rejection of accesses near the end of flash.
> Signed-off-by: Daniel Hobi <daniel.hobi@schmid-telecom.ch>
> ---
> @Scott: please review
> @Wolfgang: please consider for 2009.11
Applied to next. I think it's too late for 2009.12, since it's supposed to
be released tomorrow according to http://www.denx.de/wiki/U-Boot/ReleaseCycle,
and it's not a regression from the previous version.
-Scott
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] Fix computation in nand_util.c:get_len_incl_bad
2009-12-01 23:55 ` Scott Wood
@ 2009-12-05 0:44 ` Wolfgang Denk
0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2009-12-05 0:44 UTC (permalink / raw)
To: u-boot
Dear Scott Wood,
In message <20091201235510.GA19547@loki.buserror.net> you wrote:
>
> > @Scott: please review
> > @Wolfgang: please consider for 2009.11
>
> Applied to next. I think it's too late for 2009.12, since it's supposed to
> be released tomorrow according to http://www.denx.de/wiki/U-Boot/ReleaseCycle,
> and it's not a regression from the previous version.
Heh. We don't even have -rc2 yet.
Please feel free to send me a pull request if you consider it a fix.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I had the rare misfortune of being one of the first people to try and
implement a PL/1 compiler. -- T. Cheatham
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] Fix computation in nand_util.c:get_len_incl_bad
2009-12-01 13:05 [U-Boot] [PATCH] Fix computation in nand_util.c:get_len_incl_bad Daniel Hobi
2009-12-01 23:55 ` Scott Wood
@ 2009-12-07 21:38 ` Wolfgang Denk
1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2009-12-07 21:38 UTC (permalink / raw)
To: u-boot
Dear Daniel Hobi,
In message <1259672755-929-1-git-send-email-daniel.hobi@schmid-telecom.ch> you wrote:
> Depending on offset, flash size and the number of bad blocks,
> get_len_incl_bad may return a too small value which may lead to:
>
> 1) If there are no bad blocks, nand_{read,write}_skip_bad chooses the
> bad block aware read/write code. This may hurt performance, but does
> not have any adverse effects.
>
> 2) If there are bad blocks, the nand_{read,write}_skip_bad may choose
> the bad block unaware read/write code (if len_incl_bad == *length)
> which leads to corrupted data.
>
> Signed-off-by: Daniel Hobi <daniel.hobi@schmid-telecom.ch>
> ---
> @Scott: please review
> @Wolfgang: please consider for 2009.11
>
> diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Intelligence without character is a dangerous thing." - G. Steinem
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-12-07 21:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-01 13:05 [U-Boot] [PATCH] Fix computation in nand_util.c:get_len_incl_bad Daniel Hobi
2009-12-01 23:55 ` Scott Wood
2009-12-05 0:44 ` Wolfgang Denk
2009-12-07 21:38 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox