[U-Boot] [PATCH v3] arm: socfpga: mailbox: Fix off-by-one error on command length checking

Ley Foon Tan lftan.linux at gmail.com
Mon Apr 22 01:20:07 UTC 2019


On Sun, Apr 21, 2019 at 4:30 PM Marek Vasut <marex at denx.de> wrote:
>
> On 4/19/19 10:52 PM, Simon Goldschmidt wrote:
> >
> >
> > Marek Vasut <marex at denx.de <mailto:marex at denx.de>> schrieb am Fr., 19.
> > Apr. 2019, 11:29:
> >
> >     On 4/19/19 8:17 AM, Ley Foon Tan wrote:
> >     > A mailbox command contains 1-DWORD header + arguments. The "len"
> >     variable
> >     > only contains the length of the arguments, but not the 1-DWORD header.
> >     > Include the length of header when checking the ring buffer space to
> >     > prevent off-by-one error.
> >
> >     How long is a DWORD ? Windows API (which we have nothing to do with)
> >     defines that as 32bit type, "typedef unsigned long DWORD;", see [1].
> >     But the patch below fixes an off-by-one error , not off by four error ?
> >
> >
> > As all the macros for that mailbox seem to do u32 index access only, I'd
> > be ok with the commit message if it didn't use the term 'DWORD'...
>
> Does that mean MBOX_CMD_BUFFER_SIZE is not in byte units, but in u32 units ?
Yes, it is in u32 unit. One slot location is u32.
How about change DWORD to u32 in commit message?


Regards
Ley Foon


More information about the U-Boot mailing list