提交 a9c08b0a 编写于 作者: V Vitaly Osipov 提交者: Greg Kroah-Hartman

staging: lustre: return -EFAULT instead of bytes remaining

return -EFAULT instead of the value returned by copy_from_user()
Signed-off-by: NVitaly Osipov <vitaly.osipov@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 751a624a
...@@ -45,14 +45,12 @@ int libcfs_ioctl_getdata(char *buf, char *end, void *arg) ...@@ -45,14 +45,12 @@ int libcfs_ioctl_getdata(char *buf, char *end, void *arg)
struct libcfs_ioctl_hdr *hdr; struct libcfs_ioctl_hdr *hdr;
struct libcfs_ioctl_data *data; struct libcfs_ioctl_data *data;
int orig_len; int orig_len;
int err;
hdr = (struct libcfs_ioctl_hdr *)buf; hdr = (struct libcfs_ioctl_hdr *)buf;
data = (struct libcfs_ioctl_data *)buf; data = (struct libcfs_ioctl_data *)buf;
err = copy_from_user(buf, (void *)arg, sizeof(*hdr)); if (copy_from_user(buf, (void *)arg, sizeof(*hdr)))
if (err) return -EFAULT;
return err;
if (hdr->ioc_version != LIBCFS_IOCTL_VERSION) { if (hdr->ioc_version != LIBCFS_IOCTL_VERSION) {
CERROR("PORTALS: version mismatch kernel vs application\n"); CERROR("PORTALS: version mismatch kernel vs application\n");
...@@ -71,9 +69,8 @@ int libcfs_ioctl_getdata(char *buf, char *end, void *arg) ...@@ -71,9 +69,8 @@ int libcfs_ioctl_getdata(char *buf, char *end, void *arg)
} }
orig_len = hdr->ioc_len; orig_len = hdr->ioc_len;
err = copy_from_user(buf, (void *)arg, hdr->ioc_len); if (copy_from_user(buf, (void *)arg, hdr->ioc_len))
if (err) return -EFAULT;
return err;
if (orig_len != data->ioc_len) if (orig_len != data->ioc_len)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册