From d50889585ef23e105596105a1f2b8d431c184daa Mon Sep 17 00:00:00 2001 From: Ashish Mhetre Date: Fri, 10 Mar 2023 17:27:53 +0000 Subject: [PATCH] gpu: nvgpu: os: linux: Zero out dma_buf_map struct UBSAN is reporting "invalid-load include/linux/dma-buf-map.h". This is because non-boolean value loaded to bool variable is_iomem of dma_buf_map struct. Zeroing out this struct at declaration time make sure that there is no garbage value which will be non-boolean. Bug 3994163 Change-Id: Ib18448e8fc09cbcb25c3eeb3e5deec805f6ed008 Signed-off-by: Ashish Mhetre Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2869262 Tested-by: Bitan Biswas Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: Bitan Biswas GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/os/linux/dmabuf_priv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/os/linux/dmabuf_priv.c b/drivers/gpu/nvgpu/os/linux/dmabuf_priv.c index 363ee68d4..aa035889b 100644 --- a/drivers/gpu/nvgpu/os/linux/dmabuf_priv.c +++ b/drivers/gpu/nvgpu/os/linux/dmabuf_priv.c @@ -335,9 +335,9 @@ static void *__gk20a_dmabuf_vmap(struct dma_buf *dmabuf) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) - struct iosys_map map; + struct iosys_map map = {0}; #else - struct dma_buf_map map; + struct dma_buf_map map = {0}; #endif /* Linux v5.11 and later kernels */ if (dma_buf_vmap(dmabuf, &map))