amdgpu: fix "add AMDGPU_VA_RANGE_HIGH"
authorChristian König <christian.koenig@amd.com>
Wed, 28 Feb 2018 14:39:46 +0000 (15:39 +0100)
committerChristian König <christian.koenig@amd.com>
Wed, 28 Feb 2018 19:04:32 +0000 (20:04 +0100)
The range is stored as exclusive, not inclusive. Subtracts one to get
the inclusive interval for the calculation. This fixes crashes when 32bit
addresses are in use.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
amdgpu/amdgpu_device.c

index 9ff6ad1..fb2cfb5 100644 (file)
@@ -323,9 +323,9 @@ int amdgpu_query_sw_info(amdgpu_device_handle dev, enum amdgpu_sw_info info,
        switch (info) {
        case amdgpu_sw_info_address32_hi:
                if (dev->vamgr_high_32.va_max)
-                       *val32 = dev->vamgr_high_32.va_max >> 32;
+                       *val32 = (dev->vamgr_high_32.va_max - 1) >> 32;
                else
-                       *val32 = dev->vamgr_32.va_max >> 32;
+                       *val32 = (dev->vamgr_32.va_max - 1) >> 32;
                return 0;
        }
        return -EINVAL;