diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-11-01 22:09:04 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-12-05 14:33:36 -0500 |
commit | cbbd26b8b1a6af9c02e2b6523e12bd50cc765059 (patch) | |
tree | 6d1b258c99e83f320cf3611bdc927121df7e9b03 /net/tipc/msg.c | |
parent | e5517c2a5a49ed5e99047008629f1cd60246ea0e (diff) |
[iov_iter] new primitives - copy_from_iter_full() and friends
copy_from_iter_full(), copy_from_iter_full_nocache() and
csum_and_copy_from_iter_full() - counterparts of copy_from_iter()
et.al., advancing iterator only in case of successful full copy
and returning whether it had been successful or not.
Convert some obvious users. *NOTE* - do not blindly assume that
something is a good candidate for those unless you are sure that
not advancing iov_iter in failure case is the right thing in
this case. Anything that does short read/short write kind of
stuff (or is in a loop, etc.) is unlikely to be a good one.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/tipc/msg.c')
-rw-r--r-- | net/tipc/msg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/tipc/msg.c b/net/tipc/msg.c index 17201aa8423d..a22be502f1bd 100644 --- a/net/tipc/msg.c +++ b/net/tipc/msg.c | |||
@@ -268,7 +268,7 @@ int tipc_msg_build(struct tipc_msg *mhdr, struct msghdr *m, | |||
268 | __skb_queue_tail(list, skb); | 268 | __skb_queue_tail(list, skb); |
269 | skb_copy_to_linear_data(skb, mhdr, mhsz); | 269 | skb_copy_to_linear_data(skb, mhdr, mhsz); |
270 | pktpos = skb->data + mhsz; | 270 | pktpos = skb->data + mhsz; |
271 | if (copy_from_iter(pktpos, dsz, &m->msg_iter) == dsz) | 271 | if (copy_from_iter_full(pktpos, dsz, &m->msg_iter)) |
272 | return dsz; | 272 | return dsz; |
273 | rc = -EFAULT; | 273 | rc = -EFAULT; |
274 | goto error; | 274 | goto error; |
@@ -299,7 +299,7 @@ int tipc_msg_build(struct tipc_msg *mhdr, struct msghdr *m, | |||
299 | if (drem < pktrem) | 299 | if (drem < pktrem) |
300 | pktrem = drem; | 300 | pktrem = drem; |
301 | 301 | ||
302 | if (copy_from_iter(pktpos, pktrem, &m->msg_iter) != pktrem) { | 302 | if (!copy_from_iter_full(pktpos, pktrem, &m->msg_iter)) { |
303 | rc = -EFAULT; | 303 | rc = -EFAULT; |
304 | goto error; | 304 | goto error; |
305 | } | 305 | } |