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 <amhetre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2869262
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Ashish Mhetre
2023-03-10 17:27:53 +00:00
committed by mobile promotions
parent 8c97129c12
commit d50889585e

View File

@@ -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, 11, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
struct iosys_map map; struct iosys_map map = {0};
#else #else
struct dma_buf_map map; struct dma_buf_map map = {0};
#endif #endif
/* Linux v5.11 and later kernels */ /* Linux v5.11 and later kernels */
if (dma_buf_vmap(dmabuf, &map)) if (dma_buf_vmap(dmabuf, &map))