Skip to contentSkip to conversation

drm/amd/amdgpu: fix offset into page with amdgpu_iomem debugfs file

PATCH In review Tom St Denis 2 participants 2 messages Mar 20, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -2
index 291dd3d600cd..d2ab40494a4c 100644
@@ -1996,7 +1996,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;
@@ -2040,7 +2040,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;
Signature · 6 lines
2.14.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Am 20.03.2018 um 14:16 schrieb Tom St Denis:

Quoted 5 lines

The offset inside the page wasn't included in the copy call meaning the start of the page was being read/written instead.

Good catch, patch is Reviewed-by: Christian König <[email protected]>.

Regards,
Christian.

Quoted 18 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
index 291dd3d600cd..d2ab40494a4c 100644
@@ -1996,7 +1996,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;

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static ssize_t amdgpu_iomem_write(struct file *f, const char __user *buf, · line 2046

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -2040,7 +2040,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;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx