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

Wolfgang Denk wd at denx.de
Mon Jan 12 22:12:29 CET 2015


Dear Gerlando Falauto,

In message <54B380C2.4050208 at keymile.com> you wrote:
> 
> That's right, and that's the whole point: cmp_buf points to the data 
> read from the flash sector before erasing it, because that's what we 
> want to keep (by re-writing it).
> The first part, however, we overwrite with the new data (buf).
> So there's nothing to erase.

Well, if we have only a partially filled buffer, then there is some
remainder which is left over from previous use.  This should not make
it to external storage.  If you write any additional bytes, these
should be known-to-be-harmless content, say all 0x00 or 0xFF bytes,
but never any data that just happen to be there.

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
For every complex problem, there is a solution that is simple,  neat,
and wrong.                                           -- H. L. Mencken


More information about the U-Boot mailing list