mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 08:31:13 +00:00
[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>
This commit is contained in:
parent
e5517c2a5a
commit
cbbd26b8b1
17 changed files with 121 additions and 39 deletions
|
@ -2432,14 +2432,11 @@ static int __packet_snd_vnet_parse(struct virtio_net_hdr *vnet_hdr, size_t len)
|
|||
static int packet_snd_vnet_parse(struct msghdr *msg, size_t *len,
|
||||
struct virtio_net_hdr *vnet_hdr)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (*len < sizeof(*vnet_hdr))
|
||||
return -EINVAL;
|
||||
*len -= sizeof(*vnet_hdr);
|
||||
|
||||
n = copy_from_iter(vnet_hdr, sizeof(*vnet_hdr), &msg->msg_iter);
|
||||
if (n != sizeof(*vnet_hdr))
|
||||
if (!copy_from_iter_full(vnet_hdr, sizeof(*vnet_hdr), &msg->msg_iter))
|
||||
return -EFAULT;
|
||||
|
||||
return __packet_snd_vnet_parse(vnet_hdr, *len);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue