diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2013-07-10 06:58:59 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2013-07-11 19:48:45 -0400 |
commit | 5e631a03af7eaa55b9ef7fa7611144c2c698c6c6 (patch) | |
tree | 6c6d5a4df7d60a7eaa849c0dd10b41d64fd8855d /drivers/infiniband/hw | |
parent | 288dde9f23b6726c1e8147bf635721372bf77b16 (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/infiniband/hw')
-rw-r--r-- | drivers/infiniband/hw/mlx5/mr.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index e2daa8f02476..bd41df95b6f0 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c | |||
@@ -171,7 +171,7 @@ static ssize_t size_write(struct file *filp, const char __user *buf, | |||
171 | int c; | 171 | int c; |
172 | 172 | ||
173 | if (copy_from_user(lbuf, buf, sizeof(lbuf))) | 173 | if (copy_from_user(lbuf, buf, sizeof(lbuf))) |
174 | return -EPERM; | 174 | return -EFAULT; |
175 | 175 | ||
176 | c = order2idx(dev, ent->order); | 176 | c = order2idx(dev, ent->order); |
177 | lbuf[sizeof(lbuf) - 1] = 0; | 177 | lbuf[sizeof(lbuf) - 1] = 0; |
@@ -208,7 +208,7 @@ static ssize_t size_read(struct file *filp, char __user *buf, size_t count, | |||
208 | return err; | 208 | return err; |
209 | 209 | ||
210 | if (copy_to_user(buf, lbuf, err)) | 210 | if (copy_to_user(buf, lbuf, err)) |
211 | return -EPERM; | 211 | return -EFAULT; |
212 | 212 | ||
213 | *pos += err; | 213 | *pos += err; |
214 | 214 | ||
@@ -233,7 +233,7 @@ static ssize_t limit_write(struct file *filp, const char __user *buf, | |||
233 | int c; | 233 | int c; |
234 | 234 | ||
235 | if (copy_from_user(lbuf, buf, sizeof(lbuf))) | 235 | if (copy_from_user(lbuf, buf, sizeof(lbuf))) |
236 | return -EPERM; | 236 | return -EFAULT; |
237 | 237 | ||
238 | c = order2idx(dev, ent->order); | 238 | c = order2idx(dev, ent->order); |
239 | lbuf[sizeof(lbuf) - 1] = 0; | 239 | lbuf[sizeof(lbuf) - 1] = 0; |
@@ -270,7 +270,7 @@ static ssize_t limit_read(struct file *filp, char __user *buf, size_t count, | |||
270 | return err; | 270 | return err; |
271 | 271 | ||
272 | if (copy_to_user(buf, lbuf, err)) | 272 | if (copy_to_user(buf, lbuf, err)) |
273 | return -EPERM; | 273 | return -EFAULT; |
274 | 274 | ||
275 | *pos += err; | 275 | *pos += err; |
276 | 276 | ||