cifs: don't use memcpy() to copy struct iov_iter
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 21 Sep 2016 22:18:23 +0000 (18:18 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 27 Sep 2016 22:13:04 +0000 (18:13 -0400)
it's not 70s anymore.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/cifs/file.c

index 579e41b350a2df88e13de9e5d39abbff4ae6aa95..42b99af74e0a99e1855e42a32d525f98331051cd 100644 (file)
@@ -2478,7 +2478,7 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,
        size_t cur_len;
        unsigned long nr_pages, num_pages, i;
        struct cifs_writedata *wdata;
-       struct iov_iter saved_from;
+       struct iov_iter saved_from = *from;
        loff_t saved_offset = offset;
        pid_t pid;
        struct TCP_Server_Info *server;
@@ -2489,7 +2489,6 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,
                pid = current->tgid;
 
        server = tlink_tcon(open_file->tlink)->ses->server;
-       memcpy(&saved_from, from, sizeof(struct iov_iter));
 
        do {
                unsigned int wsize, credits;
@@ -2551,8 +2550,7 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,
                        kref_put(&wdata->refcount,
                                 cifs_uncached_writedata_release);
                        if (rc == -EAGAIN) {
-                               memcpy(from, &saved_from,
-                                      sizeof(struct iov_iter));
+                               *from = saved_from;
                                iov_iter_advance(from, offset - saved_offset);
                                continue;
                        }
@@ -2576,7 +2574,7 @@ ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from)
        struct cifs_sb_info *cifs_sb;
        struct cifs_writedata *wdata, *tmp;
        struct list_head wdata_list;
-       struct iov_iter saved_from;
+       struct iov_iter saved_from = *from;
        int rc;
 
        /*
@@ -2597,8 +2595,6 @@ ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from)
        if (!tcon->ses->server->ops->async_writev)
                return -ENOSYS;
 
-       memcpy(&saved_from, from, sizeof(struct iov_iter));
-
        rc = cifs_write_from_iter(iocb->ki_pos, iov_iter_count(from), from,
                                  open_file, cifs_sb, &wdata_list);
 
@@ -2631,13 +2627,11 @@ restart_loop:
                        /* resend call if it's a retryable error */
                        if (rc == -EAGAIN) {
                                struct list_head tmp_list;
-                               struct iov_iter tmp_from;
+                               struct iov_iter tmp_from = saved_from;
 
                                INIT_LIST_HEAD(&tmp_list);
                                list_del_init(&wdata->list);
 
-                               memcpy(&tmp_from, &saved_from,
-                                      sizeof(struct iov_iter));
                                iov_iter_advance(&tmp_from,
                                                 wdata->offset - iocb->ki_pos);