anv: attempt to make coverity happy

Coverity is upset that we're using `ptr` after we've `munmap`ed up to
the offset of the region, even though we're just moving past the
unmapped region to the still mapped region. Attempt to make it happy by
doing that calculation before unmapping. If it's still mad there's
nothing left we can do.

CID: 1646981
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
CID: 1646956
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35114>
This commit is contained in:
Dylan Baker
2025-05-22 09:54:01 -07:00
committed by Marge Bot
parent ff5cb90880
commit 25dd3923dc
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -187,10 +187,12 @@ i915_gem_mmap_offset(struct anv_device *device, struct anv_bo *bo,
if (ptr == MAP_FAILED)
return ptr;
void *ret = ptr + offset;
if (offset != 0)
munmap(ptr, offset);
return ptr + offset;
return ret;
}
static void *
+3 -1
View File
@@ -131,10 +131,12 @@ xe_gem_mmap(struct anv_device *device, struct anv_bo *bo, uint64_t offset,
if (ptr == MAP_FAILED)
return ptr;
void *ret = ptr + offset;
if (offset != 0)
munmap(ptr, offset);
return ptr + offset;
return ret;
}
static inline uint32_t