diff options
author | David S. Miller <davem@davemloft.net> | 2015-02-04 23:46:55 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-04 23:46:55 -0500 |
commit | f2683b743f2334ef49a5361bf596dd1fbd2c9be4 (patch) | |
tree | 7f53b2614742238e966ba8a815ef6c5079422ee2 /include/linux/skbuff.h | |
parent | 9878196578286c5ed494778ada01da094377a686 (diff) | |
parent | 57dd8a0735aabff4862025cf64ad94da3d80e620 (diff) |
Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
More iov_iter work from Al Viro.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 5405dfe02572..111e665455c3 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -2487,19 +2487,18 @@ static inline int skb_put_padto(struct sk_buff *skb, unsigned int len) | |||
2487 | } | 2487 | } |
2488 | 2488 | ||
2489 | static inline int skb_add_data(struct sk_buff *skb, | 2489 | static inline int skb_add_data(struct sk_buff *skb, |
2490 | char __user *from, int copy) | 2490 | struct iov_iter *from, int copy) |
2491 | { | 2491 | { |
2492 | const int off = skb->len; | 2492 | const int off = skb->len; |
2493 | 2493 | ||
2494 | if (skb->ip_summed == CHECKSUM_NONE) { | 2494 | if (skb->ip_summed == CHECKSUM_NONE) { |
2495 | int err = 0; | 2495 | __wsum csum = 0; |
2496 | __wsum csum = csum_and_copy_from_user(from, skb_put(skb, copy), | 2496 | if (csum_and_copy_from_iter(skb_put(skb, copy), copy, |
2497 | copy, 0, &err); | 2497 | &csum, from) == copy) { |
2498 | if (!err) { | ||
2499 | skb->csum = csum_block_add(skb->csum, csum, off); | 2498 | skb->csum = csum_block_add(skb->csum, csum, off); |
2500 | return 0; | 2499 | return 0; |
2501 | } | 2500 | } |
2502 | } else if (!copy_from_user(skb_put(skb, copy), from, copy)) | 2501 | } else if (copy_from_iter(skb_put(skb, copy), copy, from) == copy) |
2503 | return 0; | 2502 | return 0; |
2504 | 2503 | ||
2505 | __skb_trim(skb, off); | 2504 | __skb_trim(skb, off); |
@@ -2696,8 +2695,7 @@ int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); | |||
2696 | 2695 | ||
2697 | static inline int memcpy_from_msg(void *data, struct msghdr *msg, int len) | 2696 | static inline int memcpy_from_msg(void *data, struct msghdr *msg, int len) |
2698 | { | 2697 | { |
2699 | /* XXX: stripping const */ | 2698 | return copy_from_iter(data, len, &msg->msg_iter) == len ? 0 : -EFAULT; |
2700 | return memcpy_fromiovec(data, (struct iovec *)msg->msg_iter.iov, len); | ||
2701 | } | 2699 | } |
2702 | 2700 | ||
2703 | static inline int memcpy_to_msg(struct msghdr *msg, void *data, int len) | 2701 | static inline int memcpy_to_msg(struct msghdr *msg, void *data, int len) |