summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/msm/msm_rd.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-07-13 13:35:29 +0300
committerRob Clark <robdclark@gmail.com>2016-07-16 17:29:32 +0300
commit5745d21f9a92fa3b70149df69574a13becc3d53e (patch)
treeff3a878abd84eafc7b77c146a73c1f8192a8df4f /drivers/gpu/drm/msm/msm_rd.c
parent06f3217207766b4bc2e56b88e0736037ae92fd30 (diff)
downloadlinux-5745d21f9a92fa3b70149df69574a13becc3d53e.tar.xz
drm/msm: return -EFAULT instead of bytes remaining
copy_to/from_user returns the number of bytes remaining to be copied but we want to return -EFAULT. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_rd.c')
-rw-r--r--drivers/gpu/drm/msm/msm_rd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c
index 24254e07bcd5..3a5fdfcd67ae 100644
--- a/drivers/gpu/drm/msm/msm_rd.c
+++ b/drivers/gpu/drm/msm/msm_rd.c
@@ -149,9 +149,10 @@ static ssize_t rd_read(struct file *file, char __user *buf,
goto out;
n = min_t(int, sz, circ_count_to_end(&rd->fifo));
- ret = copy_to_user(buf, fptr, n);
- if (ret)
+ if (copy_to_user(buf, fptr, n)) {
+ ret = -EFAULT;
goto out;
+ }
fifo->tail = (fifo->tail + n) & (BUF_SZ - 1);
*ppos += n;