From de418f6ef634220194514a72db332d9fba350856 Mon Sep 17 00:00:00 2001 From: Vikas Siddhabhaktula Date: Thu, 28 Oct 2021 17:47:20 +0530 Subject: nvgpu: fix incorrect mem_desc_count - Fix incorrect mem_desc_count increment in the case of failure - Increment it only when there is a success Bug 3399680 Change-Id: I8c04e4859422fb86367113c58ce3e34cab952b63 Signed-off-by: Vikas Siddhabhaktula Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2618229 Reviewed-by: Thomas Steinle Reviewed-by: Phoenix Jung Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu') diff --git a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c index 1f537d48..926f243d 100644 --- a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c +++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_mm_gp10b.c @@ -1,7 +1,7 @@ /* * Virtualized GPU Memory Management * - * Copyright (c) 2015-2020, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2015-2021, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -130,11 +130,12 @@ u64 vgpu_gp10b_locked_gmmu_map(struct vm_gk20a *vm, chunk_length = min(size, nvgpu_sgt_get_length(sgt, sgl) - space_to_skip); - if (add_mem_desc(&mem_desc[mem_desc_count++], phys_addr, + if (add_mem_desc(&mem_desc[mem_desc_count], phys_addr, chunk_length, &oob_size)) { err = -ENOMEM; goto fail; } + mem_desc_count++; space_to_skip = 0; size -= chunk_length; -- cgit v1.2.2