[U-Boot] [PATCH] mmc and fat bug fixes

Wolfgang Denk wd at denx.de
Thu May 16 07:55:16 CEST 2013


Dear Ruud Commandeur,

In message <15AE5A936F5E3A42A9144E66875A0A89308F2E at server1-derijp.CLB-Benelux.lokaal> you wrote:
> This patch fixes a number of mmc and fat-related bugs:
> 
> > Added a check for blkcnt > 0 in mmc_write_blocks (drivers/mmc.c) to preve=
> nt a hangup for further mmc commands.
> 
> > Solved a checksum issue in fs/fat/fat.c. The mkcksum has const char argum=
> ents with a size specifier, like "const char name[8]". In the function, it =
> is assumed that sizeof(name) will have the value 8, but this is not the cas=
> e (at least not for the Sourcery CodeBench compiler and probably not accord=
> ing to ANSI C). This causes "long filename checksum errors" for each fat fi=
> le listed or written.

Please explain.  Under which exact conditions would  sizeof(name) not
be 8, and where is such assumption supported in ANSI C?


I am tempted to NAK the FAT changes, as they make the code much harder
to read and to maintain.

Using this simple test program:

----- snip ----
#include <stdio.h>

int main(void)
{
	const char name[8];
	const char ext[3];

	printf("sizeof(name)=%d, expected 8\n", sizeof(name));
	printf("sizeof(ext) =%d, expected 3\n", sizeof(name));

	return 0;
}
----- snip ----

I get the expected values on all systems and with all compilers I
tested.   For which exact configuration do you get different results?

> > Made some changes to fs/fat/fat_write.c. Fixed testing fat_val for 0xffff=
> /0xfff8 and 0xfffffff/0xffffff8 by adding the corresponding fatsize in the =
> test (as read in earlier posts) and some changes in debug output.

Please restrict your line length in commit messages to some 70
characters or so.


> Signed-off-by: Ruud Commandeur <rcommandeur at clb.nl>
> Cc: Tom Rini <trini at ti.com>
> Cc: Beno=EEt Th=E9baudeau <benoit.thebaudeau at advansee.com>
> Cc: Mats Karrman <Mats.Karrman at tritech.se>

Please split into three separate patches, one for MMX, and two for
FAT, one for each problem.  And make sure to add the MMC custodian
on Cc:

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
The existence of god implies a violation of causality.


More information about the U-Boot mailing list