drm/amdgpu: Use correct size when access vram
authorxinhui pan <xinhui.pan@amd.com>
Mon, 22 Mar 2021 00:48:54 +0000 (08:48 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 9 Apr 2021 20:39:49 +0000 (16:39 -0400)
To make size is 4 byte aligned. Use &~0x3ULL instead of &3ULL.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

index 8f98103..07e72d8 100644 (file)
@@ -1503,7 +1503,7 @@ static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo,
                                memcpy(buf, &value, bytes);
                        }
                } else {
-                       bytes = cursor.size & 0x3ull;
+                       bytes = cursor.size & ~0x3ULL;
                        amdgpu_device_vram_access(adev, cursor.start,
                                                  (uint32_t *)buf, bytes,
                                                  write);