int c;
if (copy_from_user(lbuf, buf, sizeof(lbuf)))
- return -EPERM;
+ return -EFAULT;
c = order2idx(dev, ent->order);
lbuf[sizeof(lbuf) - 1] = 0;
return err;
if (copy_to_user(buf, lbuf, err))
- return -EPERM;
+ return -EFAULT;
*pos += err;
int c;
if (copy_from_user(lbuf, buf, sizeof(lbuf)))
- return -EPERM;
+ return -EFAULT;
c = order2idx(dev, ent->order);
lbuf[sizeof(lbuf) - 1] = 0;
return err;
if (copy_to_user(buf, lbuf, err))
- return -EPERM;
+ return -EFAULT;
*pos += err;
return -ENOMEM;
if (copy_from_user(lbuf, buf, sizeof(lbuf)))
- return -EPERM;
+ return -EFAULT;
lbuf[sizeof(lbuf) - 1] = 0;
return -ENOMEM;
if (copy_from_user(ptr, buf, count)) {
- err = -EPERM;
+ err = -EFAULT;
goto out;
}
dbg->in_msg = ptr;
copy = min_t(int, count, dbg->outlen);
if (copy_to_user(buf, dbg->out_msg, copy))
- return -EPERM;
+ return -EFAULT;
*pos += copy;
return err;
if (copy_to_user(buf, &outlen, err))
- return -EPERM;
+ return -EFAULT;
*pos += err;
dbg->outlen = 0;
if (copy_from_user(outlen_str, buf, count))
- return -EPERM;
+ return -EFAULT;
outlen_str[7] = 0;
struct mlx5_cmd_stats *stats;
u64 field = 0;
int ret;
- int err;
char tbuf[22];
if (*pos)
spin_unlock(&stats->lock);
ret = snprintf(tbuf, sizeof(tbuf), "%llu\n", field);
if (ret > 0) {
- err = copy_to_user(buf, tbuf, ret);
- if (err)
- return err;
+ if (copy_to_user(buf, tbuf, ret))
+ return -EFAULT;
}
*pos += ret;
char tbuf[18];
u64 field;
int ret;
- int err;
if (*pos)
return 0;
ret = snprintf(tbuf, sizeof(tbuf), "0x%llx\n", field);
if (ret > 0) {
- err = copy_to_user(buf, tbuf, ret);
- if (err)
- return err;
+ if (copy_to_user(buf, tbuf, ret))
+ return -EFAULT;
}
*pos += ret;