OSDN Git Service

anv/allocator: Use VG_NOACCESS_WRITE in anv_bo_pool_free
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 8 Sep 2016 04:33:48 +0000 (21:33 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 13 Sep 2016 17:44:03 +0000 (10:44 -0700)
commit6ac469a6c33d7b5b6a1e0abcb4761e9ca05fa449
tree7275046ec7c75123227a6bce1b28e1338294334d
parent3943888c94beca69e575b8d3d1ec7a6cbf474ee4
anv/allocator: Use VG_NOACCESS_WRITE in anv_bo_pool_free

Previously, we were relying on the fact that VALGRIND_MEMPOOL_FREE came
later on in the function to prevent "link->bo = bo" from causing an invalid
write.  However, in the case where the size requested by the user is very
small (less than sizeof(struct anv_bo)), this isn't sufficient.  Instead,
we should call VALGRIND_MEMPOOL_FREE early and then use VG_NOACCESS_WRITE.
We do, however, have to call VALGRIND_MEMPOOL_FREE after reading bo_in
because it may be stored in the bo itself.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/anv_allocator.c