amdgpu: fix vamgr_free_va logic
authormonk.liu <monk.liu@amd.com>
Wed, 13 May 2015 06:01:53 +0000 (14:01 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 5 Aug 2015 17:47:49 +0000 (13:47 -0400)
va+size will overflow if va equals to AMDGPU_INVALID_VA_ADDRESS, just
return when hit that condition

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
amdgpu/amdgpu_vamgr.c

index 877e0baaf03d118dc412e3968dcfae5c32dcb418..34c28878eb4e4332549bb332934c8e78ca0c5500 100644 (file)
@@ -113,6 +113,9 @@ void amdgpu_vamgr_free_va(struct amdgpu_bo_va_mgr *mgr, uint64_t va,
 {
        struct amdgpu_bo_va_hole *hole;
 
+       if (va == AMDGPU_INVALID_VA_ADDRESS)
+               return;
+
        size = ALIGN(size, mgr->va_alignment);
 
        pthread_mutex_lock(&mgr->bo_va_mutex);