[U-Boot] [PATCH 17/17] spi: Avoid using malloc() in a critical function

Urja Rannikko urjaman at gmail.com
Mon May 20 16:35:55 UTC 2019


Hi Simon,

On Mon, May 20, 2019 at 7:09 PM Simon Glass <sjg at chromium.org> wrote:
>
> Hi Urja,
<snip>
> Is it possible to add a build-time assert for this somewhere?
I'm not sure, you'd need to check every user of these operations - i
was going to suggest just bailing out with an error code or a runtime
assert, and going through the users of the SPI_MEM_OP macros to make
sure there's no surprises.
>
> Is VLA very large array? How large is very large?
VLA as in variable length array, the C feature you're using above.
For a reference of sorts, more on VLAs and the kernel, which got rid
of them in 4.20: https://lwn.net/Articles/749064/

> I think the stack is much better place than a fixed buffer for
> something only 8 bytes in size.
Yes.



-- 
Urja Rannikko


More information about the U-Boot mailing list