diff options
-rw-r--r-- | drivers/infiniband/hw/mlx5/mr.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | 12 |
3 files changed, 13 insertions, 17 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 | ||
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, | |||
693 | return -ENOMEM; | 693 | return -ENOMEM; |
694 | 694 | ||
695 | if (copy_from_user(lbuf, buf, sizeof(lbuf))) | 695 | if (copy_from_user(lbuf, buf, sizeof(lbuf))) |
696 | return -EPERM; | 696 | return -EFAULT; |
697 | 697 | ||
698 | lbuf[sizeof(lbuf) - 1] = 0; | 698 | lbuf[sizeof(lbuf) - 1] = 0; |
699 | 699 | ||
@@ -889,7 +889,7 @@ static ssize_t data_write(struct file *filp, const char __user *buf, | |||
889 | return -ENOMEM; | 889 | return -ENOMEM; |
890 | 890 | ||
891 | if (copy_from_user(ptr, buf, count)) { | 891 | if (copy_from_user(ptr, buf, count)) { |
892 | err = -EPERM; | 892 | err = -EFAULT; |
893 | goto out; | 893 | goto out; |
894 | } | 894 | } |
895 | dbg->in_msg = ptr; | 895 | dbg->in_msg = ptr; |
@@ -919,7 +919,7 @@ static ssize_t data_read(struct file *filp, char __user *buf, size_t count, | |||
919 | 919 | ||
920 | copy = min_t(int, count, dbg->outlen); | 920 | copy = min_t(int, count, dbg->outlen); |
921 | if (copy_to_user(buf, dbg->out_msg, copy)) | 921 | if (copy_to_user(buf, dbg->out_msg, copy)) |
922 | return -EPERM; | 922 | return -EFAULT; |
923 | 923 | ||
924 | *pos += copy; | 924 | *pos += copy; |
925 | 925 | ||
@@ -949,7 +949,7 @@ static ssize_t outlen_read(struct file *filp, char __user *buf, size_t count, | |||
949 | return err; | 949 | return err; |
950 | 950 | ||
951 | if (copy_to_user(buf, &outlen, err)) | 951 | if (copy_to_user(buf, &outlen, err)) |
952 | return -EPERM; | 952 | return -EFAULT; |
953 | 953 | ||
954 | *pos += err; | 954 | *pos += err; |
955 | 955 | ||
@@ -974,7 +974,7 @@ static ssize_t outlen_write(struct file *filp, const char __user *buf, | |||
974 | dbg->outlen = 0; | 974 | dbg->outlen = 0; |
975 | 975 | ||
976 | if (copy_from_user(outlen_str, buf, count)) | 976 | if (copy_from_user(outlen_str, buf, count)) |
977 | return -EPERM; | 977 | return -EFAULT; |
978 | 978 | ||
979 | outlen_str[7] = 0; | 979 | outlen_str[7] = 0; |
980 | 980 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c index a550a8ef94a1..4273c06e2e96 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | |||
@@ -148,7 +148,6 @@ static ssize_t average_read(struct file *filp, char __user *buf, size_t count, | |||
148 | struct mlx5_cmd_stats *stats; | 148 | struct mlx5_cmd_stats *stats; |
149 | u64 field = 0; | 149 | u64 field = 0; |
150 | int ret; | 150 | int ret; |
151 | int err; | ||
152 | char tbuf[22]; | 151 | char tbuf[22]; |
153 | 152 | ||
154 | if (*pos) | 153 | if (*pos) |
@@ -161,9 +160,8 @@ static ssize_t average_read(struct file *filp, char __user *buf, size_t count, | |||
161 | spin_unlock(&stats->lock); | 160 | spin_unlock(&stats->lock); |
162 | ret = snprintf(tbuf, sizeof(tbuf), "%llu\n", field); | 161 | ret = snprintf(tbuf, sizeof(tbuf), "%llu\n", field); |
163 | if (ret > 0) { | 162 | if (ret > 0) { |
164 | err = copy_to_user(buf, tbuf, ret); | 163 | if (copy_to_user(buf, tbuf, ret)) |
165 | if (err) | 164 | return -EFAULT; |
166 | return err; | ||
167 | } | 165 | } |
168 | 166 | ||
169 | *pos += ret; | 167 | *pos += ret; |
@@ -418,7 +416,6 @@ static ssize_t dbg_read(struct file *filp, char __user *buf, size_t count, | |||
418 | char tbuf[18]; | 416 | char tbuf[18]; |
419 | u64 field; | 417 | u64 field; |
420 | int ret; | 418 | int ret; |
421 | int err; | ||
422 | 419 | ||
423 | if (*pos) | 420 | if (*pos) |
424 | return 0; | 421 | return 0; |
@@ -445,9 +442,8 @@ static ssize_t dbg_read(struct file *filp, char __user *buf, size_t count, | |||
445 | 442 | ||
446 | ret = snprintf(tbuf, sizeof(tbuf), "0x%llx\n", field); | 443 | ret = snprintf(tbuf, sizeof(tbuf), "0x%llx\n", field); |
447 | if (ret > 0) { | 444 | if (ret > 0) { |
448 | err = copy_to_user(buf, tbuf, ret); | 445 | if (copy_to_user(buf, tbuf, ret)) |
449 | if (err) | 446 | return -EFAULT; |
450 | return err; | ||
451 | } | 447 | } |
452 | 448 | ||
453 | *pos += ret; | 449 | *pos += ret; |