video: tegra: nvmap: Correct value of nvmap_total_page_allocs

Rectify overflow check for nvmap_total_page_allocs. Also, move
the value update of nvmap_total_page_allocs outside the else
block to update it for when contiguous is both true and false.

Bug 4479044

Change-Id: I9e06b7903c44f05a55d7d9aef98a04c920e102ae
Signed-off-by: N V S Abhishek <nabhishek@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3291713
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
This commit is contained in:
N V S Abhishek
2025-01-27 18:13:54 +00:00
committed by Jon Hunter
parent fdd6ff24e3
commit f4cd590333

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* SPDX-FileCopyrightText: Copyright (c) 2011-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2011-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* Handle allocation and freeing routines for nvmap
*/
@@ -179,13 +179,13 @@ static int handle_page_alloc(struct nvmap_client *client,
if (pages[i] == NULL)
goto fail;
}
if (check_add_overflow(nvmap_big_page_allocs, (u64)nr_page, &result))
goto fail;
nvmap_total_page_allocs = result;
}
if (check_add_overflow(nvmap_total_page_allocs, (u64)nr_page, &result))
goto fail;
nvmap_total_page_allocs = result;
/*
* Make sure any data in the caches is cleaned out before
* passing these pages to userspace. Many nvmap clients assume that