video: tegra: nvmap: Fix INT08-C using overflow.h

- pend-pstart may wrap, hence using check_sub_overflow.

JIRA: TMM-5724

Bug 4479044

Change-Id: I0214a453919ab6d789811b3cb02525d3c78b7932
Signed-off-by: Surbhi Singh <surbhis@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3232443
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
This commit is contained in:
Surbhi Singh
2024-10-18 03:55:15 +00:00
committed by Jon Hunter
parent 28668cde01
commit c79fe58101

View File

@@ -164,6 +164,7 @@ static int do_cache_maint(struct cache_maint_op *cache_work)
int err = 0;
struct nvmap_handle *h = cache_work->h;
unsigned int op = cache_work->op;
phys_addr_t difference;
if (!h || !h->alloc)
return -EFAULT;
@@ -204,11 +205,10 @@ per_page_phy_cache_maint:
h->flags != NVMAP_HANDLE_INNER_CACHEABLE);
out:
if (!err) {
nvmap_stats_inc(NS_CFLUSH_DONE, pend - pstart);
}
if (!err && !check_sub_overflow(pend, pstart, &difference))
nvmap_stats_inc(NS_CFLUSH_DONE, difference);
trace_nvmap_cache_flush(pend - pstart,
trace_nvmap_cache_flush(difference,
nvmap_stats_read(NS_ALLOC),
nvmap_stats_read(NS_CFLUSH_RQ),
nvmap_stats_read(NS_CFLUSH_DONE));