diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-09-21 18:18:23 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-09-27 18:13:04 -0400 |
commit | fc56b9838a20d4c8a0ca6bb8ecfa2e7f0834ab0f (patch) | |
tree | b8cba63baf433768ed2582eeb544ec2f7f5bf7b6 | |
parent | 4bce9f6ee8f84fdf333d0fd7fcf7f0d8c7cce7fa (diff) |
cifs: don't use memcpy() to copy struct iov_iter
it's not 70s anymore.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/cifs/file.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 579e41b350a2..42b99af74e0a 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -2478,7 +2478,7 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from, | |||
2478 | size_t cur_len; | 2478 | size_t cur_len; |
2479 | unsigned long nr_pages, num_pages, i; | 2479 | unsigned long nr_pages, num_pages, i; |
2480 | struct cifs_writedata *wdata; | 2480 | struct cifs_writedata *wdata; |
2481 | struct iov_iter saved_from; | 2481 | struct iov_iter saved_from = *from; |
2482 | loff_t saved_offset = offset; | 2482 | loff_t saved_offset = offset; |
2483 | pid_t pid; | 2483 | pid_t pid; |
2484 | struct TCP_Server_Info *server; | 2484 | struct TCP_Server_Info *server; |
@@ -2489,7 +2489,6 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from, | |||
2489 | pid = current->tgid; | 2489 | pid = current->tgid; |
2490 | 2490 | ||
2491 | server = tlink_tcon(open_file->tlink)->ses->server; | 2491 | server = tlink_tcon(open_file->tlink)->ses->server; |
2492 | memcpy(&saved_from, from, sizeof(struct iov_iter)); | ||
2493 | 2492 | ||
2494 | do { | 2493 | do { |
2495 | unsigned int wsize, credits; | 2494 | unsigned int wsize, credits; |
@@ -2551,8 +2550,7 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from, | |||
2551 | kref_put(&wdata->refcount, | 2550 | kref_put(&wdata->refcount, |
2552 | cifs_uncached_writedata_release); | 2551 | cifs_uncached_writedata_release); |
2553 | if (rc == -EAGAIN) { | 2552 | if (rc == -EAGAIN) { |
2554 | memcpy(from, &saved_from, | 2553 | *from = saved_from; |
2555 | sizeof(struct iov_iter)); | ||
2556 | iov_iter_advance(from, offset - saved_offset); | 2554 | iov_iter_advance(from, offset - saved_offset); |
2557 | continue; | 2555 | continue; |
2558 | } | 2556 | } |
@@ -2576,7 +2574,7 @@ ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from) | |||
2576 | struct cifs_sb_info *cifs_sb; | 2574 | struct cifs_sb_info *cifs_sb; |
2577 | struct cifs_writedata *wdata, *tmp; | 2575 | struct cifs_writedata *wdata, *tmp; |
2578 | struct list_head wdata_list; | 2576 | struct list_head wdata_list; |
2579 | struct iov_iter saved_from; | 2577 | struct iov_iter saved_from = *from; |
2580 | int rc; | 2578 | int rc; |
2581 | 2579 | ||
2582 | /* | 2580 | /* |
@@ -2597,8 +2595,6 @@ ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from) | |||
2597 | if (!tcon->ses->server->ops->async_writev) | 2595 | if (!tcon->ses->server->ops->async_writev) |
2598 | return -ENOSYS; | 2596 | return -ENOSYS; |
2599 | 2597 | ||
2600 | memcpy(&saved_from, from, sizeof(struct iov_iter)); | ||
2601 | |||
2602 | rc = cifs_write_from_iter(iocb->ki_pos, iov_iter_count(from), from, | 2598 | rc = cifs_write_from_iter(iocb->ki_pos, iov_iter_count(from), from, |
2603 | open_file, cifs_sb, &wdata_list); | 2599 | open_file, cifs_sb, &wdata_list); |
2604 | 2600 | ||
@@ -2631,13 +2627,11 @@ restart_loop: | |||
2631 | /* resend call if it's a retryable error */ | 2627 | /* resend call if it's a retryable error */ |
2632 | if (rc == -EAGAIN) { | 2628 | if (rc == -EAGAIN) { |
2633 | struct list_head tmp_list; | 2629 | struct list_head tmp_list; |
2634 | struct iov_iter tmp_from; | 2630 | struct iov_iter tmp_from = saved_from; |
2635 | 2631 | ||
2636 | INIT_LIST_HEAD(&tmp_list); | 2632 | INIT_LIST_HEAD(&tmp_list); |
2637 | list_del_init(&wdata->list); | 2633 | list_del_init(&wdata->list); |
2638 | 2634 | ||
2639 | memcpy(&tmp_from, &saved_from, | ||
2640 | sizeof(struct iov_iter)); | ||
2641 | iov_iter_advance(&tmp_from, | 2635 | iov_iter_advance(&tmp_from, |
2642 | wdata->offset - iocb->ki_pos); | 2636 | wdata->offset - iocb->ki_pos); |
2643 | 2637 | ||