* [U-Boot] [PATCH 2/2] fat: cannot compare bytes and sectors
@ 2011-08-08 19:39 Sergei Shtylyov
2011-10-01 19:51 ` Wolfgang Denk
0 siblings, 1 reply; 2+ messages in thread
From: Sergei Shtylyov @ 2011-08-08 19:39 UTC (permalink / raw)
To: u-boot
The code multiples the FAT size in sectors by the sector size and then tries to
compare that to the number of sectors in the 'getsize' variable. While fixing
this, also change the initial value of 'getsize' as the division of FATBUFSIZE
by the sector size gets us FATBUFBLOCKS.
Signed-off-by: Sergei Shtylyov <sshtylyov@mvista.com>
---
fs/fat/fat.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: u-boot/fs/fat/fat.c
===================================================================
--- u-boot.orig/fs/fat/fat.c
+++ u-boot/fs/fat/fat.c
@@ -209,16 +209,17 @@ static __u32 get_fatent (fsdata *mydata,
/* Read a new block of FAT entries into the cache. */
if (bufnum != mydata->fatbufnum) {
- __u32 getsize = FATBUFSIZE / mydata->sect_size;
+ __u32 getsize = FATBUFBLOCKS;
__u8 *bufptr = mydata->fatbuf;
__u32 fatlength = mydata->fatlength;
__u32 startblock = bufnum * FATBUFBLOCKS;
+ if (getsize > fatlength)
+ getsize = fatlength;
+
fatlength *= mydata->sect_size; /* We want it in bytes now */
startblock += mydata->fat_sect; /* Offset from start of disk */
- if (getsize > fatlength)
- getsize = fatlength;
if (disk_read(startblock, getsize, bufptr) < 0) {
debug("Error reading FAT blocks\n");
return ret;
^ permalink raw reply [flat|nested] 2+ messages in thread* [U-Boot] [PATCH 2/2] fat: cannot compare bytes and sectors
2011-08-08 19:39 [U-Boot] [PATCH 2/2] fat: cannot compare bytes and sectors Sergei Shtylyov
@ 2011-10-01 19:51 ` Wolfgang Denk
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2011-10-01 19:51 UTC (permalink / raw)
To: u-boot
Dear Sergei Shtylyov,
In message <201108082339.29933.sshtylyov@ru.mvista.com> you wrote:
> The code multiples the FAT size in sectors by the sector size and then tries to
> compare that to the number of sectors in the 'getsize' variable. While fixing
> this, also change the initial value of 'getsize' as the division of FATBUFSIZE
> by the sector size gets us FATBUFBLOCKS.
>
> Signed-off-by: Sergei Shtylyov <sshtylyov@mvista.com>
>
> ---
> fs/fat/fat.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
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
"Why waste negative entropy on comments, when you could use the same
entropy to create bugs instead?" - Steve Elias
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-01 19:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-08 19:39 [U-Boot] [PATCH 2/2] fat: cannot compare bytes and sectors Sergei Shtylyov
2011-10-01 19:51 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox