From f4cd5903332deb4e2d70da684ccf1fdf70d0f29f Mon Sep 17 00:00:00 2001 From: N V S Abhishek Date: Mon, 27 Jan 2025 18:13:54 +0000 Subject: [PATCH] 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 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3291713 Reviewed-by: Sachin Nikam Reviewed-by: Pritesh Raithatha GVS: buildbot_gerritrpt Reviewed-by: Ketan Patil --- drivers/video/tegra/nvmap/nvmap_alloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/video/tegra/nvmap/nvmap_alloc.c b/drivers/video/tegra/nvmap/nvmap_alloc.c index c0c53f60..27596e42 100644 --- a/drivers/video/tegra/nvmap/nvmap_alloc.c +++ b/drivers/video/tegra/nvmap/nvmap_alloc.c @@ -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