mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 18:28:12 +02:00
blob: Don't valgrind assert for defined memory if we aren't writing.
The VK pipeline cache passes a NULL bytes with a nonzero size to a NULL-data blob to set up the size of the blob. In this case, we don't actually execute the memcpy, so the non-existent "bytes" doesn't need to have defined contents. Avoids a valgrind warning: ==972858== Unaddressable byte(s) found during client check request ==972858== at 0x147F4166: blob_write_bytes (blob.c:165) ==972858== by 0x147F4166: blob_write_bytes (blob.c:158) ==972858== by 0x14695FFF: vk_pipeline_cache_object_serialize (vk_pipeline_cache.c:240) [...] ==972858== Address 0x0 is not stack'd, malloc'd or (recently) free'd Fixes:591da98779("vulkan: Add a common VkPipelineCache implementation") Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22617> (cherry picked from commitae2784b832)
This commit is contained in:
parent
e6d8483846
commit
55dc3b5009
2 changed files with 4 additions and 4 deletions
|
|
@ -1219,7 +1219,7 @@
|
|||
"description": "blob: Don't valgrind assert for defined memory if we aren't writing.",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "591da9877900c56434f9e23e0ad0058b118b0be8"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -160,10 +160,10 @@ blob_write_bytes(struct blob *blob, const void *bytes, size_t to_write)
|
|||
if (! grow_to_fit(blob, to_write))
|
||||
return false;
|
||||
|
||||
VG(VALGRIND_CHECK_MEM_IS_DEFINED(bytes, to_write));
|
||||
|
||||
if (blob->data && to_write > 0)
|
||||
if (blob->data && to_write > 0) {
|
||||
VG(VALGRIND_CHECK_MEM_IS_DEFINED(bytes, to_write));
|
||||
memcpy(blob->data + blob->size, bytes, to_write);
|
||||
}
|
||||
blob->size += to_write;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue