[PATCH 16/17] net/nfp: fix null pointer dereferences
Chaoyong He
chaoyong.he at corigine.com
Mon Jun 24 03:57:22 CEST 2024
CI found null pointer dereferences problem.
Coverity issue: 426271
Fixes: 153ef2e49ed7 ("net/nfp: add process private structure")
Cc: stable at dpdk.org
Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
Reviewed-by: Long Wu <long.wu at corigine.com>
Reviewed-by: Peng Zhang <peng.zhang at corigine.com>
---
drivers/net/nfp/nfp_net_common.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 84893e2d73..aed40daa67 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -1265,6 +1265,8 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
hw = nfp_net_get_hw(dev);
hw_priv = dev->process_private;
+ if (hw_priv == NULL)
+ return -EINVAL;
nfp_net_rx_desc_limits(hw_priv, &min_rx_desc, &max_rx_desc);
nfp_net_tx_desc_limits(hw, hw_priv, &min_tx_desc, &max_tx_desc);
@@ -1367,7 +1369,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
}
/* Only PF supports getting speed capability. */
- if (hw_priv != NULL && hw_priv->pf_dev != NULL)
+ if (hw_priv->pf_dev != NULL)
dev_info->speed_capa = hw_priv->pf_dev->speed_capa;
return 0;
--
2.39.1
More information about the dev
mailing list