[U-Boot] [PATCH] cmd_sf: Fix problem with "sf update" and unaligned length

Wolfgang Denk wd at denx.de
Mon Jan 12 08:17:18 CET 2015


Dear Stefan,

In message <1420810762-10712-1-git-send-email-sr at denx.de> you wrote:
>
> The new code is even simpler and copies the source data into the temp
> buffer and now uses the temp buffer to write the complete sector. So
> only one SPI sector write is used now instead of 2 in the old version.
...

>  	if (len != flash->sector_size) {
> -		/* Rewrite the original data to the end of the sector */
> -		if (spi_flash_write(flash, offset + len,
> -				    flash->sector_size - len, &cmp_buf[len]))
> -			return "write";
> +		memcpy(cmp_buf, buf, len);
> +		ptr = cmp_buf;
>  	}

Should we add a  memset(buf, 0, sizeof(buf))  before the memcpy() to
prevent information from earlier activities to leak?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
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 read part of it all the way through.


More information about the U-Boot mailing list