aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom St Denis <tom.stdenis@amd.com>2017-05-23 11:35:22 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-05-24 18:23:55 -0400
commit9156e723301c0a7a7def4cde820e018ce791b842 (patch)
tree25e3490da0e52e2c7b4c5f39a609b63c048e5740
parente7f78b69aba479728865ef3ec4229b372fc79f94 (diff)
drm/amd/amdgpu: Return error if initiating read out of range on vram
If you initiate a read that is out of the VRAM address space return ENXIO instead of 0. Reads that begin below that point will read upto the VRAM limit as before. Cc: stable@vger.kernel.org Signed-off-by: Tom St Denis <tom.stdenis@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index fcf617c237ef..8526a0222268 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1468,6 +1468,9 @@ static ssize_t amdgpu_ttm_vram_read(struct file *f, char __user *buf,
1468 if (size & 0x3 || *pos & 0x3) 1468 if (size & 0x3 || *pos & 0x3)
1469 return -EINVAL; 1469 return -EINVAL;
1470 1470
1471 if (*pos >= adev->mc.mc_vram_size)
1472 return -ENXIO;
1473
1471 while (size) { 1474 while (size) {
1472 unsigned long flags; 1475 unsigned long flags;
1473 uint32_t value; 1476 uint32_t value;