Commit 9403cd7c authored by Jarno Rajahalme's avatar Jarno Rajahalme Committed by David S. Miller

virtio_net: Do not clear memory for struct virtio_net_hdr twice.

virtio_net_hdr_from_skb() clears the memory for the header, so there
is no point for the callers to do the same.
Signed-off-by: default avatarJarno Rajahalme <jarno@ovn.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d66016a7
...@@ -1360,8 +1360,7 @@ static ssize_t tun_put_user(struct tun_struct *tun, ...@@ -1360,8 +1360,7 @@ static ssize_t tun_put_user(struct tun_struct *tun,
} }
if (vnet_hdr_sz) { if (vnet_hdr_sz) {
struct virtio_net_hdr gso = { 0 }; /* no info leak */ struct virtio_net_hdr gso;
int ret;
if (iov_iter_count(iter) < vnet_hdr_sz) if (iov_iter_count(iter) < vnet_hdr_sz)
return -EINVAL; return -EINVAL;
......
...@@ -58,7 +58,7 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, ...@@ -58,7 +58,7 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
struct virtio_net_hdr *hdr, struct virtio_net_hdr *hdr,
bool little_endian) bool little_endian)
{ {
memset(hdr, 0, sizeof(*hdr)); memset(hdr, 0, sizeof(*hdr)); /* no info leak */
if (skb_is_gso(skb)) { if (skb_is_gso(skb)) {
struct skb_shared_info *sinfo = skb_shinfo(skb); struct skb_shared_info *sinfo = skb_shinfo(skb);
......
...@@ -1970,8 +1970,6 @@ static unsigned int run_filter(struct sk_buff *skb, ...@@ -1970,8 +1970,6 @@ static unsigned int run_filter(struct sk_buff *skb,
static int __packet_rcv_vnet(const struct sk_buff *skb, static int __packet_rcv_vnet(const struct sk_buff *skb,
struct virtio_net_hdr *vnet_hdr) struct virtio_net_hdr *vnet_hdr)
{ {
*vnet_hdr = (const struct virtio_net_hdr) { 0 };
if (virtio_net_hdr_from_skb(skb, vnet_hdr, vio_le())) if (virtio_net_hdr_from_skb(skb, vnet_hdr, vio_le()))
BUG(); BUG();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment