ethdev: fix xstats retrieval with a null array
[dpdk.git] / lib / librte_ether / rte_ethdev.c
index fd49b26..dcf9e6f 100644 (file)
@@ -1536,7 +1536,7 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats,
                        return xcount;
        }
 
-       if (n < count + xcount)
+       if (n < count + xcount || xstats == NULL)
                return count + xcount;
 
        /* now fill the xstats structure */