Skip to content

Commit

Permalink
virtio_net: fix return value check in receive_mergeable()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
wyjwang authored and mstsirkin committed Dec 7, 2017
1 parent 25f3222 commit 03e9f8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
int num_skb_frags;

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",
dev->name, num_buf,
virtio16_to_cpu(vi->vdev,
Expand Down

0 comments on commit 03e9f8a

Please sign in to comment.