[U-Boot] [PATCH] Pad data length for nand write

Scott Wood scottwood at freescale.com
Tue Feb 17 19:51:55 CET 2009


On Tue, Feb 17, 2009 at 10:15:07AM -0700, Derek Ou wrote:
> +	/* Reject writes when offset is not page aligned */
> +	if ((offset & (nand->writesize - 1)) != 0 ) {

No space before ')'.  Better yet, just get rid of the != 0 part.

> +	/* 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