[U-Boot] [PATCH] Pad data length for nand write
Derek Ou
derek at siconix.com
Tue Feb 17 21:54:00 CET 2009
This routine is copied from nand_write_opts() at nand_util.c of v1.3.4.
It maybe better
to pad data length and data buffer in do_nand() at cmd_nand.c. But I
don't see real
difference. I didn't allocate a new buffer since the data length is
defined in the command
arguments and I have no knowledge of a safe location and large enough
memory space
to store data.
Maybe we should implement, like Wolfgang said, a "+length" syntax in the
"nand write"
command to indicates "round up to the next page boundary". In this
case, do_nand()
can assume that it's safe to write pass memory address (add + length)
and Flash offset
(off + length).
Derek
Scott Wood wrote:
> On Tue, Feb 17, 2009 at 10:15:07AM -0700, Derek Ou wrote:
>
>> + /* now, pad data with 0xff */
>> + if (page_offset != 0)
>> + memset(buffer + *length, 0xff, pad_len);
>>
> You cannot write to the caller's buffer (or worse, past the end of the
> caller's buffer) like this. You'll need to allocate a new, padded
> buffer.
>
> -Scott
>
More information about the U-Boot
mailing list