mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
nvmap: Fix incorrect deallocator SAST defect
Deallocator vfree is used when kfree should be used. Use nvmap_altfree earlier and set pages to NULL, to use appropriate deallocator function and fix 1 ALLOC_FREE_MISMATCH SAST defect. Bug 4479044 Change-Id: I0257107fcef31271f14775bc3f6354390caf08f0 Signed-off-by: N V S Abhishek <nabhishek@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3118540 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
Jon Hunter
parent
efeecacbd1
commit
cb2e183b22
@@ -79,9 +79,11 @@ void *__nvmap_mmap(struct nvmap_handle *h)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
vaddr = vmap(pages, h->size >> PAGE_SHIFT, VM_MAP, prot);
|
vaddr = vmap(pages, h->size >> PAGE_SHIFT, VM_MAP, prot);
|
||||||
|
nvmap_altfree(pages, (h->size >> PAGE_SHIFT) * sizeof(*pages));
|
||||||
|
pages = NULL;
|
||||||
|
|
||||||
if (!vaddr && !h->vaddr)
|
if (!vaddr && !h->vaddr)
|
||||||
goto out;
|
goto out;
|
||||||
nvmap_altfree(pages, (h->size >> PAGE_SHIFT) * sizeof(*pages));
|
|
||||||
|
|
||||||
if (vaddr && atomic_long_cmpxchg((atomic_long_t *)(void *)&h->vaddr, 0,
|
if (vaddr && atomic_long_cmpxchg((atomic_long_t *)(void *)&h->vaddr, 0,
|
||||||
(long)vaddr)) {
|
(long)vaddr)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user