summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-07-03 12:46:20 +0300
committerAlex Deucher <alexander.deucher@amd.com>2021-07-09 00:47:28 +0300
commit64598e23de7873b9d47cd9b9a02daa2bb4ded343 (patch)
treeaf0cd220498c8145cfb44a1af2898b41aa065ba2
parentb8badd507a5b76a8e58c864b01116f3de43464cb (diff)
downloadlinux-64598e23de7873b9d47cd9b9a02daa2bb4ded343.tar.xz
drm/amdgpu: return -EFAULT if copy_to_user() fails
If copy_to_user() fails then this should return -EFAULT instead of -EINVAL. Fixes: c65b0805e77919 ("drm/amdgpu: RAS EEPROM table is now in debugfs") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Luben Tuikov <luben.tuikov@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
index 3e33e85d8dbc..d2e5b2567bc1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
@@ -771,7 +771,7 @@ amdgpu_ras_debugfs_eeprom_size_read(struct file *f, char __user *buf,
res = min_t(size_t, res, size);
if (copy_to_user(buf, &data[*pos], res))
- return -EINVAL;
+ return -EFAULT;
*pos += res;
@@ -950,7 +950,7 @@ amdgpu_ras_debugfs_eeprom_table_read(struct file *f, char __user *buf,
res = min_t(size_t, res, size);
if (copy_to_user(buf, &data[*pos], res))
- return -EINVAL;
+ return -EFAULT;
*pos += res;