This is the mail archive of the mailing list for the eCos project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: flash/am29xxxxx flash_program_buf length fix

Peter Korsgaard wrote:
> --- packages/devs/flash/amd/am29xxxxx/current/ChangeLog	12 Jun 2005 13:41:11 -0000	1.35
> +++ packages/devs/flash/amd/am29xxxxx/current/ChangeLog	31 Aug 2005 20:19:57 -0000
> @@ -1,5 +1,10 @@
> +2005-08-31  Peter Korsgaard  <>
> +
> +	* include/flash_am29xxxxx.inl (flash_program_buf): Round up length
> +	to next multiple of flash word size.

I don't think this is correct.  You're going to overwrite the partial
word following the buffer you're writing with garbage.

I think instead an check (in addition to the check to ensure the buffer
is word-size aligned) needs to be made at the start of
flash_program_buf() to ensure the len is a multiple of word size.
Something like this, I think:

        return FLASH_ERR_INVALID;

This will require that you fix the caller.

David Vrabel
David Vrabel, Design Engineer

Arcom, Clifton Road           Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK         Web:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]