Some testpmd application commands will use 'rss_conf->rss_key' parameter with a NULL value to call 'rte_eth_dev_rss_hash_conf_get()' API, and NFP PMD will coredump at these situations.
Fix this by add a check about the 'rss_conf->rss_key' pointer. Fixes: 934e4c60fbff ("nfp: add RSS") Cc: sta...@dpdk.org Signed-off-by: Chaoyong He <chaoyong...@corigine.com> Reviewed-by: Long Wu <long...@corigine.com> Reviewed-by: Peng Zhang <peng.zh...@corigine.com> --- drivers/net/nfp/nfp_net_common.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index aaa515bac2..600fcd5c0e 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -2062,9 +2062,11 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, rss_conf->rss_key_len = nn_cfg_readl(hw, NFP_NET_CFG_RSS_KEY_SZ); /* Reading the key byte a byte */ - for (i = 0; i < rss_conf->rss_key_len; i++) { - key = nn_cfg_readb(hw, NFP_NET_CFG_RSS_KEY + i); - memcpy(&rss_conf->rss_key[i], &key, 1); + if (rss_conf->rss_key != NULL) { + for (i = 0; i < rss_conf->rss_key_len; i++) { + key = nn_cfg_readb(hw, NFP_NET_CFG_RSS_KEY + i); + memcpy(&rss_conf->rss_key[i], &key, 1); + } } return 0; -- 2.43.5