[PATCH] gpu: drm: use struct_size() in kmalloc()

Gustavo A. R. Silva gustavo at embeddedor.com
Tue May 21 12:57:36 UTC 2019

On 5/21/19 3:59 AM, Christian K├Ânig wrote:

> BTW: Is there actually good documentation how to correctly do the variable length array at end of structure thing in the kernel?
> I do know that I've seen a lot of different variants like array[] array[0] or array[1] and I have also seen a bunch of gcc versions failing to generate correct
> code for some of them.
> So we should probably nail down how to do things correctly.

A flexible array member is the preferred[1] mechanism:



[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html

More information about the amd-gfx mailing list