[U-Boot] [PATCH 1/2] mmc: add boundary check for mmc operation

Wolfgang Denk wd at denx.de
Mon Sep 13 11:47:51 CEST 2010


Dear Lei Wen,

when posting new versions of patches, please always

1) make sure the messages are properly threaded, i. e. make sure to
   provide proper references to the previous postings;
   "git send-email" asks for the message ID.
2) show in the Subject that tthios is a new version of the patch (for
   example by using "[PATCH 1/2 v2]", and add (in the comment section,
   i. e. below the "---" line, a description of what was changed
   respective to the previous version(s).

Thanks.

In message <1284369459-29997-1-git-send-email-leiwen at marvell.com> you wrote:
> Signed-off-by: Lei Wen <leiwen at marvell.com>
> ---
>  drivers/mmc/mmc.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index cf4ea16..42638f6 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -92,6 +92,11 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
>  
>  	blklen = mmc->write_bl_len;
>  
> +	if ((start + blkcnt) > mmc->block_dev.lba) {
> +		puts("operation exceed mmc boundary..\n"
> +		     "This devices only have 0x%x blocks\n", mmc->block_dev.lba);

puts() does not perform output formatting. You want printf() here (and
below).

Also, try to use a shorter message, for example:

	printf("MMC: block number 0x%x = %d exceeds max (0x%x = %d)", ...);


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
"Beauty is transitory." "Beauty survives."
	-- Spock and Kirk, "That Which Survives", stardate unknown


More information about the U-Boot mailing list