All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio_net: fix the potential NULL pointer in xmit_skb()
@ 2014-02-14  4:00 Zhi Yong Wu
  2014-02-14  5:12 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Zhi Yong Wu @ 2014-02-14  4:00 UTC (permalink / raw)
  To: netdev; +Cc: Zhi Yong Wu

The pointer hdr isn't assigned before hdr->mhdr and hdr->hdr
are used, so it could be one invalid pointer.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 drivers/net/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index d75f8ed..bf6397f 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -807,9 +807,9 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
 
 	pr_debug("%s: xmit %p %pM\n", vi->dev->name, skb, dest);
 	if (vi->mergeable_rx_bufs)
-		hdr_len = sizeof hdr->mhdr;
+		hdr_len = sizeof(struct virtio_net_hdr_mrg_rxbuf);
 	else
-		hdr_len = sizeof hdr->hdr;
+		hdr_len = sizeof(struct virtio_net_hdr);
 
 	can_push = vi->any_header_sg &&
 		!((unsigned long)skb->data & (__alignof__(*hdr) - 1)) &&
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-14  5:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-14  4:00 [PATCH] virtio_net: fix the potential NULL pointer in xmit_skb() Zhi Yong Wu
2014-02-14  5:12 ` David Miller
2014-02-14  5:25   ` Zhi Yong Wu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.