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 <[email protected]> Sent: Wednesday, June 8, 2016 10:43 To: StDenis, Tom Cc: [email protected]; 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 <[email protected]> > >> +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
_______________________________________________ xorg-driver-ati mailing list [email protected] https://lists.x.org/mailman/listinfo/xorg-driver-ati
