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 <Jay.Cornwall@amd.com>
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>
This commit is contained in:
Tom St Denis 2018-03-20 09:13:08 -04:00 committed by Alex Deucher
parent bd08a8d9e8
commit 864917a3b8
1 changed files with 2 additions and 2 deletions

View File

@ -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;