mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
mlx5: Return -EFAULT instead of -EPERM
For copy_to/from_user() failure, the correct error code is -EFAULT not -EPERM. Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Or Gerlitz <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
This commit is contained in:
parent
288dde9f23
commit
5e631a03af
3 changed files with 13 additions and 17 deletions
|
|
@ -171,7 +171,7 @@ static ssize_t size_write(struct file *filp, const char __user *buf,
|
|||
int c;
|
||||
|
||||
if (copy_from_user(lbuf, buf, sizeof(lbuf)))
|
||||
return -EPERM;
|
||||
return -EFAULT;
|
||||
|
||||
c = order2idx(dev, ent->order);
|
||||
lbuf[sizeof(lbuf) - 1] = 0;
|
||||
|
|
@ -208,7 +208,7 @@ static ssize_t size_read(struct file *filp, char __user *buf, size_t count,
|
|||
return err;
|
||||
|
||||
if (copy_to_user(buf, lbuf, err))
|
||||
return -EPERM;
|
||||
return -EFAULT;
|
||||
|
||||
*pos += err;
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ static ssize_t limit_write(struct file *filp, const char __user *buf,
|
|||
int c;
|
||||
|
||||
if (copy_from_user(lbuf, buf, sizeof(lbuf)))
|
||||
return -EPERM;
|
||||
return -EFAULT;
|
||||
|
||||
c = order2idx(dev, ent->order);
|
||||
lbuf[sizeof(lbuf) - 1] = 0;
|
||||
|
|
@ -270,7 +270,7 @@ static ssize_t limit_read(struct file *filp, char __user *buf, size_t count,
|
|||
return err;
|
||||
|
||||
if (copy_to_user(buf, lbuf, err))
|
||||
return -EPERM;
|
||||
return -EFAULT;
|
||||
|
||||
*pos += err;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue