mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
Merge branch 'work.iov_iter' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs into read_iter
* 'work.iov_iter' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: new helper: copy_to_iter_full()
This commit is contained in:
commit
1f65f52d13
2 changed files with 11 additions and 8 deletions
|
@ -205,6 +205,16 @@ size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static __always_inline __must_check
|
||||
bool copy_to_iter_full(const void *addr, size_t bytes, struct iov_iter *i)
|
||||
{
|
||||
size_t copied = copy_to_iter(addr, bytes, i);
|
||||
if (likely(copied == bytes))
|
||||
return true;
|
||||
iov_iter_revert(i, copied);
|
||||
return false;
|
||||
}
|
||||
|
||||
static __always_inline __must_check
|
||||
bool copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i)
|
||||
{
|
||||
|
|
|
@ -379,14 +379,7 @@ static inline bool udp_skb_is_linear(struct sk_buff *skb)
|
|||
static inline int copy_linear_skb(struct sk_buff *skb, int len, int off,
|
||||
struct iov_iter *to)
|
||||
{
|
||||
int n;
|
||||
|
||||
n = copy_to_iter(skb->data + off, len, to);
|
||||
if (n == len)
|
||||
return 0;
|
||||
|
||||
iov_iter_revert(to, n);
|
||||
return -EFAULT;
|
||||
return copy_to_iter_full(skb->data + off, len, to) ? 0 : -EFAULT;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue