[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5a9089f3-501b-24a1-202b-5a2b2ae62de6@embeddedor.com>
Date: Tue, 21 May 2019 07:57:36 -0500
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: christian.koenig@....com, Daniel Vetter <daniel@...ll.ch>,
Alex Deucher <alexdeucher@...il.com>
Cc: "Zhou, David(ChunMing)" <David1.Zhou@....com>,
"airlied@...ux.ie" <airlied@...ux.ie>,
"Pan, Xinhui" <Xinhui.Pan@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"amd-gfx@...ts.freedesktop.org" <amd-gfx@...ts.freedesktop.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"Deucher, Alexander" <Alexander.Deucher@....com>,
"Quan, Evan" <Evan.Quan@....com>
Subject: Re: [PATCH] gpu: drm: use struct_size() in kmalloc()
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:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20190520&id=76497732932f15e7323dc805e8ea8dc11bb587cf
Thanks
--
Gustavo
[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
Powered by blists - more mailing lists