From c7e1f6fe9409975544890993626964278b2c925c Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 4 Jul 2018 14:41:31 +0530 Subject: gpu: nvgpu: fix pending bytes check for vidmem In nvgpu_dma_alloc_flags_vid_at(), we check pending bytes of vidmem which are yet to be cleared by reading g->mm.vidmem.bytes_pending.atomic_var If there is something to be cleared we return EAGAIN otherwise we return ENOMEM But to store above variable we use "int before_pending" which evaluates to zero for sizes like 4GB and we end up returning ENOMEM instead of EAGAIN Fix this by declaring before_pending variable as u64 Bug 200427361 Change-Id: I6ffe977e3663a5135fa17699ecafe78ac90d9314 Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/1770384 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Konsta Holtta Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/os/linux/dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/os/linux/dma.c b/drivers/gpu/nvgpu/os/linux/dma.c index 51c8323a..6f17e284 100644 --- a/drivers/gpu/nvgpu/os/linux/dma.c +++ b/drivers/gpu/nvgpu/os/linux/dma.c @@ -329,7 +329,7 @@ int nvgpu_dma_alloc_flags_vid_at(struct gk20a *g, unsigned long flags, struct nvgpu_allocator *vidmem_alloc = g->mm.vidmem.cleared ? &g->mm.vidmem.allocator : &g->mm.vidmem.bootstrap_allocator; - int before_pending; + u64 before_pending; if (nvgpu_mem_is_valid(mem)) { nvgpu_warn(g, "memory leak !!"); -- cgit v1.2.2