Explorar o código

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>
Yunjian Wang %!s(int64=7) %!d(string=hai) anos
pai
achega
03e9f8a05b
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      drivers/net/virtio_net.c

+ 1 - 1
drivers/net/virtio_net.c

@@ -714,7 +714,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
 		int num_skb_frags;
 		int num_skb_frags;
 
 
 		buf = virtqueue_get_buf_ctx(rq->vq, &len, &ctx);
 		buf = virtqueue_get_buf_ctx(rq->vq, &len, &ctx);
-		if (unlikely(!ctx)) {
+		if (unlikely(!buf)) {
 			pr_debug("%s: rx error: %d buffers out of %d missing\n",
 			pr_debug("%s: rx error: %d buffers out of %d missing\n",
 				 dev->name, num_buf,
 				 dev->name, num_buf,
 				 virtio16_to_cpu(vi->vdev,
 				 virtio16_to_cpu(vi->vdev,