Commit fc56b983 authored by Al Viro's avatar Al Viro

cifs: don't use memcpy() to copy struct iov_iter

it's not 70s anymore.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 4bce9f6e
...@@ -2478,7 +2478,7 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from, ...@@ -2478,7 +2478,7 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,
size_t cur_len; size_t cur_len;
unsigned long nr_pages, num_pages, i; unsigned long nr_pages, num_pages, i;
struct cifs_writedata *wdata; struct cifs_writedata *wdata;
struct iov_iter saved_from; struct iov_iter saved_from = *from;
loff_t saved_offset = offset; loff_t saved_offset = offset;
pid_t pid; pid_t pid;
struct TCP_Server_Info *server; struct TCP_Server_Info *server;
...@@ -2489,7 +2489,6 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from, ...@@ -2489,7 +2489,6 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,
pid = current->tgid; pid = current->tgid;
server = tlink_tcon(open_file->tlink)->ses->server; server = tlink_tcon(open_file->tlink)->ses->server;
memcpy(&saved_from, from, sizeof(struct iov_iter));
do { do {
unsigned int wsize, credits; unsigned int wsize, credits;
...@@ -2551,8 +2550,7 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from, ...@@ -2551,8 +2550,7 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,
kref_put(&wdata->refcount, kref_put(&wdata->refcount,
cifs_uncached_writedata_release); cifs_uncached_writedata_release);
if (rc == -EAGAIN) { if (rc == -EAGAIN) {
memcpy(from, &saved_from, *from = saved_from;
sizeof(struct iov_iter));
iov_iter_advance(from, offset - saved_offset); iov_iter_advance(from, offset - saved_offset);
continue; continue;
} }
...@@ -2576,7 +2574,7 @@ ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from) ...@@ -2576,7 +2574,7 @@ ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from)
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifs_writedata *wdata, *tmp; struct cifs_writedata *wdata, *tmp;
struct list_head wdata_list; struct list_head wdata_list;
struct iov_iter saved_from; struct iov_iter saved_from = *from;
int rc; int rc;
/* /*
...@@ -2597,8 +2595,6 @@ ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from) ...@@ -2597,8 +2595,6 @@ ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from)
if (!tcon->ses->server->ops->async_writev) if (!tcon->ses->server->ops->async_writev)
return -ENOSYS; return -ENOSYS;
memcpy(&saved_from, from, sizeof(struct iov_iter));
rc = cifs_write_from_iter(iocb->ki_pos, iov_iter_count(from), from, rc = cifs_write_from_iter(iocb->ki_pos, iov_iter_count(from), from,
open_file, cifs_sb, &wdata_list); open_file, cifs_sb, &wdata_list);
...@@ -2631,13 +2627,11 @@ ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from) ...@@ -2631,13 +2627,11 @@ ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from)
/* resend call if it's a retryable error */ /* resend call if it's a retryable error */
if (rc == -EAGAIN) { if (rc == -EAGAIN) {
struct list_head tmp_list; struct list_head tmp_list;
struct iov_iter tmp_from; struct iov_iter tmp_from = saved_from;
INIT_LIST_HEAD(&tmp_list); INIT_LIST_HEAD(&tmp_list);
list_del_init(&wdata->list); list_del_init(&wdata->list);
memcpy(&tmp_from, &saved_from,
sizeof(struct iov_iter));
iov_iter_advance(&tmp_from, iov_iter_advance(&tmp_from,
wdata->offset - iocb->ki_pos); wdata->offset - iocb->ki_pos);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment