net/bnxt: fix crash in xstats get

We would hit a segfault in bnxt_dev_xstats_get_op() if xstats argument
is NULL, Check if the argument is NULL and return appropriately.

Fixes: bfb9c2260b ("net/bnxt: support xstats get/reset")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Andy Gospodarek <gospo@broadcom.com>
This commit is contained in:
Ajit Khaparde 2019-11-13 13:59:43 +05:30 committed by Ferruh Yigit
parent fcdd7210aa
commit 063e59ddd2

View File

@ -468,6 +468,9 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
if (rc)
return rc;
if (xstats == NULL)
return 0;
memset(xstats, 0, sizeof(*xstats));
bnxt_hwrm_port_qstats(bp);