[PATCH xf86-video-amdgpu 3/6] Add amdgpu_pixmap_get_tiling_info

StDenis, Tom Tom.StDenis at amd.com
Wed Jun 8 14:58:55 UTC 2016


Agreed that if you fail on 10 bytes the OOM monster is probably being woken up soon.  Unless it's performance issue it doesn't hurt to add a check and return a code (if possible in this function since it returns flags not a pointer/int).


Tom


________________________________
From: Michel Dänzer <michel at daenzer.net>
Sent: Wednesday, June 8, 2016 10:43
To: StDenis, Tom
Cc: xorg-driver-ati at lists.x.org; Yu, Qiang
Subject: Re: [PATCH xf86-video-amdgpu 3/6] Add amdgpu_pixmap_get_tiling_info

On 08.06.2016 22:57, StDenis, Tom wrote:
> From: Michel Dänzer <michel at daenzer.net>
>
>> +uint64_t amdgpu_pixmap_get_tiling_info(PixmapPtr pixmap)
>> +{
>> +       struct amdgpu_pixmap *priv = amdgpu_get_pixmap_private(pixmap);
>> +       uint32_t handle;
>> +
>> +       if (!priv || !priv->handle_valid) {
>> +               amdgpu_pixmap_get_handle(pixmap, &handle);
>> +               priv = amdgpu_get_pixmap_private(pixmap);
>
> If this fails won't you just end up with a NULL pointer?

Yes, but if calloc fails for tens of bytes, that's probably one of our
lesser concerns. :) In particular, in that case we'd already crash in
amdgpu_pixmap_get_handle before we get back here.


--
Earthling Michel Dänzer               |               http://www.amd.com
Graphics, Processors and Immersive VR Solutions | AMD <http://www.amd.com/>
www.amd.com
Explore a wide range of innovative next generation computing processors, graphics, and Immersive VR solutions by Advanced Micro Devices (AMD). Visit AMD.com now!



Libre software enthusiast             |             Mesa and X developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg-driver-ati/attachments/20160608/2e2034df/attachment.html>


More information about the xorg-driver-ati mailing list