The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: christian.koenig@amd.com, Daniel Vetter <daniel@ffwll.ch>,
	Alex Deucher <alexdeucher@gmail.com>
Cc: "Zhou, David(ChunMing)" <David1.Zhou@amd.com>,
	"airlied@linux.ie" <airlied@linux.ie>,
	"Pan, Xinhui" <Xinhui.Pan@amd.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"Quan, Evan" <Evan.Quan@amd.com>
Subject: Re: [PATCH] gpu: drm: use struct_size() in kmalloc()
Date: Tue, 21 May 2019 07:57:36 -0500	[thread overview]
Message-ID: <5a9089f3-501b-24a1-202b-5a2b2ae62de6@embeddedor.com> (raw)
In-Reply-To: <36de7e05-9055-6d8b-fb2c-fa5a4e94274b@gmail.com>



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

  reply	other threads:[~2019-05-21 13:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17  8:46 [PATCH] gpu: drm: use struct_size() in kmalloc() xiaolinkui
     [not found] ` <SN6PR12MB2800A7AEC22121C8704CBB09870B0@SN6PR12MB2800.namprd12.prod.outlook.com>
2019-05-20 16:28   ` Daniel Vetter
2019-05-20 23:19     ` 回复: " Pan, Xinhui
2019-05-21  2:32       ` Alex Deucher
2019-05-21  7:23         ` Daniel Vetter
2019-05-21  8:59           ` Christian König
2019-05-21 12:57             ` Gustavo A. R. Silva [this message]
2019-05-20 17:41 ` Alex Deucher
2019-05-20 18:21   ` Gustavo A. R. Silva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a9089f3-501b-24a1-202b-5a2b2ae62de6@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=David1.Zhou@amd.com \
    --cc=Evan.Quan@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox