DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/pfe: do not use a possibly NULL Pointer
@ 2021-05-24  8:59 Thierry Herbelot
  2021-05-24  9:25 ` Gagandeep Singh
  2021-05-24  9:37 ` [dpdk-dev] [PATCH v2] net/pfe: no need to check dev to be " Thierry Herbelot
  0 siblings, 2 replies; 5+ messages in thread
From: Thierry Herbelot @ 2021-05-24  8:59 UTC (permalink / raw)
  To: dev; +Cc: Thierry Herbelot, Thomas Monjalon, stable, Gagandeep Singh

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

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

Signed-off-by: Thierry Herbelot <thierry.herbelot@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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] net/pfe: do not use a possibly NULL Pointer
  2021-05-24  8:59 [dpdk-dev] [PATCH] net/pfe: do not use a possibly NULL Pointer Thierry Herbelot
@ 2021-05-24  9:25 ` Gagandeep Singh
  2021-05-24  9:37 ` [dpdk-dev] [PATCH v2] net/pfe: no need to check dev to be " Thierry Herbelot
  1 sibling, 0 replies; 5+ messages in thread
From: Gagandeep Singh @ 2021-05-24  9:25 UTC (permalink / raw)
  To: Thierry Herbelot, dev; +Cc: Thomas Monjalon, stable



> -----Original Message-----
> From: Thierry Herbelot <thierry.herbelot@6wind.com>
> Sent: Monday, May 24, 2021 2:29 PM
> To: dev@dpdk.org
> Cc: Thierry Herbelot <thierry.herbelot@6wind.com>; Thomas Monjalon
> <thomas@monjalon.net>; stable@dpdk.org; Gagandeep Singh
> <G.Singh@nxp.com>
> Subject: [PATCH] net/pfe: do not use a possibly NULL Pointer
> 
> Use dev only after it was checked not to be NULL.
> 
> Fixes: acd4818ea2a45 ("net/pfe: add link status update")
> Cc: stable@dpdk.org
> Cc: Gagandeep Singh <g.singh@nxp.com>
> 
> Signed-off-by: Thierry Herbelot <thierry.herbelot@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;

"dev" will never be NULL here because librte_ethdev library is already doing some checks on dev before calling the link update. So please remove the if check.
> 
>  	memset(&old, 0, sizeof(old));
>  	memset(&link, 0, sizeof(struct rte_eth_link));
> --
> 2.29.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH v2] net/pfe: no need to check dev to be NULL Pointer
  2021-05-24  8:59 [dpdk-dev] [PATCH] net/pfe: do not use a possibly NULL Pointer Thierry Herbelot
  2021-05-24  9:25 ` Gagandeep Singh
@ 2021-05-24  9:37 ` Thierry Herbelot
  2021-05-24 10:28   ` Gagandeep Singh
  1 sibling, 1 reply; 5+ messages in thread
From: Thierry Herbelot @ 2021-05-24  9:37 UTC (permalink / raw)
  To: dev; +Cc: Thierry Herbelot, Thomas Monjalon, stable, Gagandeep Singh

librte_ethdev library is already doing some checks on dev before calling
the link update.

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

Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
--
V2: rework after noting dev cannot be NULL
---
 drivers/net/pfe/pfe_ethdev.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c
index 3135466713fb..feec4d10a26e 100644
--- a/drivers/net/pfe/pfe_ethdev.c
+++ b/drivers/net/pfe/pfe_ethdev.c
@@ -582,11 +582,6 @@ pfe_eth_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
 	struct rte_eth_link link, old;
 	unsigned int lstatus = 1;
 
-	if (dev == NULL) {
-		PFE_PMD_ERR("Invalid device in link_update.\n");
-		return 0;
-	}
-
 	memset(&old, 0, sizeof(old));
 	memset(&link, 0, sizeof(struct rte_eth_link));
 
-- 
2.29.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/pfe: no need to check dev to be NULL Pointer
  2021-05-24  9:37 ` [dpdk-dev] [PATCH v2] net/pfe: no need to check dev to be " Thierry Herbelot
@ 2021-05-24 10:28   ` Gagandeep Singh
  2021-06-29  8:27     ` Andrew Rybchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Gagandeep Singh @ 2021-05-24 10:28 UTC (permalink / raw)
  To: Thierry Herbelot, dev; +Cc: Thomas Monjalon, stable



> -----Original Message-----
> From: Thierry Herbelot <thierry.herbelot@6wind.com>
> Sent: Monday, May 24, 2021 3:08 PM
> To: dev@dpdk.org
> Cc: Thierry Herbelot <thierry.herbelot@6wind.com>; Thomas Monjalon
> <thomas@monjalon.net>; stable@dpdk.org; Gagandeep Singh
> <G.Singh@nxp.com>
> Subject: [PATCH v2] net/pfe: no need to check dev to be NULL Pointer
> 
> librte_ethdev library is already doing some checks on dev before calling
> the link update.
> 
> Fixes: acd4818ea2a45 ("net/pfe: add link status update")
> Cc: stable@dpdk.org
> Cc: Gagandeep Singh <g.singh@nxp.com>
> 
> Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
> --
> V2: rework after noting dev cannot be NULL
> ---

Acked-by: Gagandeep Singh <G.singh@nxp.com>

>  drivers/net/pfe/pfe_ethdev.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c
> index 3135466713fb..feec4d10a26e 100644
> --- a/drivers/net/pfe/pfe_ethdev.c
> +++ b/drivers/net/pfe/pfe_ethdev.c
> @@ -582,11 +582,6 @@ pfe_eth_link_update(struct rte_eth_dev *dev, int
> wait_to_complete __rte_unused)
>  	struct rte_eth_link link, old;
>  	unsigned int lstatus = 1;
> 
> -	if (dev == NULL) {
> -		PFE_PMD_ERR("Invalid device in link_update.\n");
> -		return 0;
> -	}
> -
>  	memset(&old, 0, sizeof(old));
>  	memset(&link, 0, sizeof(struct rte_eth_link));
> 
> --
> 2.29.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/pfe: no need to check dev to be NULL Pointer
  2021-05-24 10:28   ` Gagandeep Singh
@ 2021-06-29  8:27     ` Andrew Rybchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Rybchenko @ 2021-06-29  8:27 UTC (permalink / raw)
  To: Gagandeep Singh, Thierry Herbelot, dev; +Cc: Thomas Monjalon, stable

On 5/24/21 1:28 PM, Gagandeep Singh wrote:
> 
> 
>> -----Original Message-----
>> From: Thierry Herbelot <thierry.herbelot@6wind.com>
>> Sent: Monday, May 24, 2021 3:08 PM
>> To: dev@dpdk.org
>> Cc: Thierry Herbelot <thierry.herbelot@6wind.com>; Thomas Monjalon
>> <thomas@monjalon.net>; stable@dpdk.org; Gagandeep Singh
>> <G.Singh@nxp.com>
>> Subject: [PATCH v2] net/pfe: no need to check dev to be NULL Pointer
>>
>> librte_ethdev library is already doing some checks on dev before calling
>> the link update.
>>
>> Fixes: acd4818ea2a45 ("net/pfe: add link status update")
>> Cc: stable@dpdk.org
>> Cc: Gagandeep Singh <g.singh@nxp.com>
>>
>> Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
>> --
>> V2: rework after noting dev cannot be NULL
>> ---
> 
> Acked-by: Gagandeep Singh <G.singh@nxp.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-29  8:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24  8:59 [dpdk-dev] [PATCH] net/pfe: do not use a possibly NULL Pointer Thierry Herbelot
2021-05-24  9:25 ` Gagandeep Singh
2021-05-24  9:37 ` [dpdk-dev] [PATCH v2] net/pfe: no need to check dev to be " Thierry Herbelot
2021-05-24 10:28   ` Gagandeep Singh
2021-06-29  8:27     ` Andrew Rybchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).