aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYunjian Wang <wangyunjian@huawei.com>2017-12-04 01:02:19 -0500
committerMichael S. Tsirkin <mst@redhat.com>2017-12-07 11:34:52 -0500
commit03e9f8a05bce7330bcd9c5cc54c8e42d0fcbf993 (patch)
tree402ab23f3edf73fcea8a110b7176bb9c76e57db1
parent25f32223bce5c580e0392a176319a587d7a17e95 (diff)
virtio_net: fix return value check in receive_mergeable()
The function virtqueue_get_buf_ctx() could return NULL, the return value 'buf' need to be checked with NULL, not value 'ctx'. Signed-off-by: Yunjian Wang <wangyunjian@huawei.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--drivers/net/virtio_net.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 511f8339fa96..7927e28f5336 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -714,7 +714,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
714 int num_skb_frags; 714 int num_skb_frags;
715 715
716 buf = virtqueue_get_buf_ctx(rq->vq, &len, &ctx); 716 buf = virtqueue_get_buf_ctx(rq->vq, &len, &ctx);
717 if (unlikely(!ctx)) { 717 if (unlikely(!buf)) {
718 pr_debug("%s: rx error: %d buffers out of %d missing\n", 718 pr_debug("%s: rx error: %d buffers out of %d missing\n",
719 dev->name, num_buf, 719 dev->name, num_buf,
720 virtio16_to_cpu(vi->vdev, 720 virtio16_to_cpu(vi->vdev,