From: Ajit Khaparde Date: Wed, 13 Nov 2019 08:29:43 +0000 (+0530) Subject: net/bnxt: fix crash in xstats get X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=063e59ddd28e3a147107366ddba9fb8baeeebc31;p=dpdk.git 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: bfb9c2260be2 ("net/bnxt: support xstats get/reset") Cc: stable@dpdk.org Signed-off-by: Ajit Khaparde Reviewed-by: Andy Gospodarek --- diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c index 40b496ac00..14d355fd08 100644 --- a/drivers/net/bnxt/bnxt_stats.c +++ b/drivers/net/bnxt/bnxt_stats.c @@ -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);