[Mesa-dev] [PATCH 1/3] i965/drm: Fix dereference-before-NULL-check in brw_bo_unmap().
Chris Wilson
chris at chris-wilson.co.uk
Thu Apr 13 06:48:08 UTC 2017
On Wed, Apr 12, 2017 at 11:33:12PM -0700, Kenneth Graunke wrote:
> I introduced this when cleaning up this code. libdrm_intel was fine.
> While passing NULL to free() is a common pattern...passing NULL to
> unmap seems pretty bad.
Yup, that was my first thought as well, arriving here with a NULL is a
bad sign. Being internal means you can be much stricter and catch these
errors at source quicker.
> You really ought to know whether you have
> a buffer or not. So, we could add an assert. Not sure whether
> that's better. This takes the defensive plan of bailing early,
> which is what libdrm_intel did originally.
>
> CID: 1405006
Free free to remove the defensive check, either way:
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the mesa-dev
mailing list