[PATCH 4/4] drm/amdgpu: return -EFAULT if copy_to_user() fails
Dan Carpenter
dan.carpenter at oracle.com
Sat Jul 3 09:46:20 UTC 2021
If copy_to_user() fails then this should return -EFAULT instead of
-EINVAL.
Fixes: 9b790694a031 ("drm/amdgpu: RAS EEPROM table is now in debugfs")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 4 ++--
1 file 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;
--
2.30.2
More information about the amd-gfx
mailing list