[dpdk-stable] [PATCH] net/pfe: do not use a possibly NULL Pointer

Thierry Herbelot thierry.herbelot at 6wind.com
Mon May 24 10:59:17 CEST 2021


Use dev only after it was checked not to be NULL.

Fixes: acd4818ea2a45 ("net/pfe: add link status update")
Cc: stable at dpdk.org
Cc: Gagandeep Singh <g.singh at nxp.com>

Signed-off-by: Thierry Herbelot <thierry.herbelot at 6wind.com>
---
 drivers/net/pfe/pfe_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c
index 3135466713fb..09048e57d973 100644
--- a/drivers/net/pfe/pfe_ethdev.c
+++ b/drivers/net/pfe/pfe_ethdev.c
@@ -578,7 +578,7 @@ static int
 pfe_eth_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
 {
 	int ret, ioctl_cmd = 0;
-	struct pfe_eth_priv_s *priv = dev->data->dev_private;
+	struct pfe_eth_priv_s *priv;
 	struct rte_eth_link link, old;
 	unsigned int lstatus = 1;
 
@@ -586,6 +586,7 @@ pfe_eth_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
 		PFE_PMD_ERR("Invalid device in link_update.\n");
 		return 0;
 	}
+	priv = dev->data->dev_private;
 
 	memset(&old, 0, sizeof(old));
 	memset(&link, 0, sizeof(struct rte_eth_link));
-- 
2.29.2



More information about the stable mailing list