mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
video: tegra: nvmap: Fix INT30-C overflow defects
Adding check for overflow in nvmap_heap.c when two unsigned integers are added and return error in case of overflow condition JIRA: TMM-5724 Bug 4479044 Change-Id: I4da3f31a508de8e4d6fab033e5a149de6b423ead Signed-off-by: Surbhi Singh <surbhis@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3241765 Reviewed-by: Ketan Patil <ketanp@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
@@ -1052,6 +1052,7 @@ void nvmap_heap_destroy(struct nvmap_heap *heap)
|
|||||||
int nvmap_heap_init(void)
|
int nvmap_heap_init(void)
|
||||||
{
|
{
|
||||||
ulong start_time = sched_clock();
|
ulong start_time = sched_clock();
|
||||||
|
ulong sum;
|
||||||
|
|
||||||
heap_block_cache = KMEM_CACHE(list_block, 0);
|
heap_block_cache = KMEM_CACHE(list_block, 0);
|
||||||
if (!heap_block_cache) {
|
if (!heap_block_cache) {
|
||||||
@@ -1059,7 +1060,10 @@ int nvmap_heap_init(void)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
pr_info("%s: created heap block cache\n", __func__);
|
pr_info("%s: created heap block cache\n", __func__);
|
||||||
nvmap_init_time += sched_clock() - start_time;
|
if (check_add_overflow((ulong)sched_clock() - start_time, nvmap_init_time, &sum))
|
||||||
|
return -EOVERFLOW;
|
||||||
|
|
||||||
|
nvmap_init_time = sum;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user