From: Tom St Denis Date: Tue, 20 Mar 2018 13:13:08 +0000 (-0400) Subject: drm/amd/amdgpu: fix offset into page with amdgpu_iomem debugfs file X-Git-Tag: v4.17-rc1~185^2~4^2~65 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=864917a3b8d459ee2cfd37a1d1c9251cca88d108;p=linux.git drm/amd/amdgpu: fix offset into page with amdgpu_iomem debugfs file The offset inside the page wasn't included in the copy call meaning the start of the page was being read/written instead. Reported-by: Jay Cornwall Signed-off-by: Tom St Denis Reviewed-by: Christian König Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index e28b73609fbc..205da3ff9cd0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -2021,7 +2021,7 @@ static ssize_t amdgpu_iomem_read(struct file *f, char __user *buf, return -EPERM; ptr = kmap(p); - r = copy_to_user(buf, ptr, bytes); + r = copy_to_user(buf, ptr + off, bytes); kunmap(p); if (r) return -EFAULT; @@ -2065,7 +2065,7 @@ static ssize_t amdgpu_iomem_write(struct file *f, const char __user *buf, return -EPERM; ptr = kmap(p); - r = copy_from_user(ptr, buf, bytes); + r = copy_from_user(ptr + off, buf, bytes); kunmap(p); if (r) return -EFAULT;