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:
@@ -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 *
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user