[PATCH libdrm] Make sure the second argument to container_of() is initialized

Rob Clark robdclark at gmail.com
Wed Aug 3 11:20:38 UTC 2016


On Wed, Aug 3, 2016 at 4:56 AM, Michel Dänzer <michel at daenzer.net> wrote:
> On 03.08.2016 02:49, Nicolai Hähnle wrote:
>> On 02.08.2016 12:08, Michel Dänzer wrote:
>>> From: Michel Dänzer <michel.daenzer at amd.com>
>>>
>>> Fixes warnings and miscompilation resulting in crashes with clang.
>>
>> How annoying. Seems like this would affect most (current and future)
>> uses of container_of, and so it would be better to switch to the Linux
>> kernel version of container_of, where the second parameter is the type...
>
> Rob proposed http://hastebin.com/vefenavoje.coffee on IRC, using
> typeof(). I'm fine with going for that instead of my patch, just FYI: My
> patch was based on xserver's list.h, which works with compilers which
> don't support typeof(). Not sure that's relevant for libdrm though.

Actually I already went ahead and pushed that patch too.  Although
there may be other list implementations that need the same thing.

BR,
-R


More information about the dri-devel mailing list