summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-07-10 13:58:59 +0300
committerRoland Dreier <roland@purestorage.com>2013-07-11 16:48:45 -0700
commit5e631a03af7eaa55b9ef7fa7611144c2c698c6c6 (patch)
tree6c6d5a4df7d60a7eaa849c0dd10b41d64fd8855d /drivers/net/ethernet/mellanox/mlx5/core/cmd.c
parent288dde9f23b6726c1e8147bf635721372bf77b16 (diff)
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 <dan.carpenter@oracle.com> Acked-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/cmd.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/cmd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
index c1c0eef89694..205753a04cfc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
@@ -693,7 +693,7 @@ static ssize_t dbg_write(struct file *filp, const char __user *buf,
return -ENOMEM;
if (copy_from_user(lbuf, buf, sizeof(lbuf)))
- return -EPERM;
+ return -EFAULT;
lbuf[sizeof(lbuf) - 1] = 0;
@@ -889,7 +889,7 @@ static ssize_t data_write(struct file *filp, const char __user *buf,
return -ENOMEM;
if (copy_from_user(ptr, buf, count)) {
- err = -EPERM;
+ err = -EFAULT;
goto out;
}
dbg->in_msg = ptr;
@@ -919,7 +919,7 @@ static ssize_t data_read(struct file *filp, char __user *buf, size_t count,
copy = min_t(int, count, dbg->outlen);
if (copy_to_user(buf, dbg->out_msg, copy))
- return -EPERM;
+ return -EFAULT;
*pos += copy;
@@ -949,7 +949,7 @@ static ssize_t outlen_read(struct file *filp, char __user *buf, size_t count,
return err;
if (copy_to_user(buf, &outlen, err))
- return -EPERM;
+ return -EFAULT;
*pos += err;
@@ -974,7 +974,7 @@ static ssize_t outlen_write(struct file *filp, const char __user *buf,
dbg->outlen = 0;
if (copy_from_user(outlen_str, buf, count))
- return -EPERM;
+ return -EFAULT;
outlen_str[7] = 0;