pan/decode: Ensure mappings are zeroed

Fixes valgrind error when running with =sync

==30966== Conditional jump or move depends on uninitialised value(s)
==30966==    at 0x5B424E8: pandecode_find_mapped_gpu_mem_containing (decode_common.c:56)
==30966==    by 0x5B4CFB7: pandecode_jc (decode.c:2075)
==30966==    by 0x5ABBFA7: panfrost_batch_submit_ioctl (pan_job.c:1020)
==30966==    by 0x5ABD397: panfrost_batch_submit_jobs (pan_job.c:1042)
==30966==    by 0x5ABD397: panfrost_batch_submit (pan_job.c:1109)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
This commit is contained in:
Alyssa Rosenzweig
2020-09-24 19:13:43 -04:00
parent 3ed7472b2a
commit 7c351a6f5d

View File

@@ -104,7 +104,7 @@ pandecode_inject_mmap(uint64_t gpu_va, void *cpu, unsigned sz, const char *name)
/* Otherwise, add a fresh mapping */
struct pandecode_mapped_memory *mapped_mem = NULL;
mapped_mem = malloc(sizeof(*mapped_mem));
mapped_mem = calloc(1, sizeof(*mapped_mem));
mapped_mem->gpu_va = gpu_va;
mapped_mem->length = sz;
mapped_mem->addr = cpu;