From: Yuanhan Liu Date: Mon, 20 Jun 2016 10:43:32 +0000 (+0800) Subject: net/virtio: fix crash on querying xstats X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7e1eb993f23fda1f91e3eca0327b0aa7821861df;p=dpdk.git net/virtio: fix crash on querying xstats Trying to access xstats_names after "if (xstats_names == NULL)" is obviously wrong, which would result to a crash while running "show port xstats 0" in testpmd with virtio PMD. The fix is straightforward; just reverse the check. Fixes: baf91c395b18 ("net/virtio: fetch extended statistics with integer ids") Signed-off-by: Yuanhan Liu --- diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 19d5d8a278..12fa6403ae 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -776,7 +776,7 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev, unsigned nstats = dev->data->nb_tx_queues * VIRTIO_NB_TXQ_XSTATS + dev->data->nb_rx_queues * VIRTIO_NB_RXQ_XSTATS; - if (xstats_names == NULL) { + if (xstats_names != NULL) { /* Note: limit checked in rte_eth_xstats_names() */ for (i = 0; i < dev->data->nb_rx_queues; i++) {