DPDK patches and discussions
 help / color / mirror / Atom feed
* Re: [dpdk-dev] [PATCH] lib: add warning for NULL pointer
  2018-12-05 11:55 [dpdk-dev] [PATCH] lib: add warning for NULL pointer Qiming Yang
@ 2018-12-05  4:37 ` Varghese, Vipin
  2018-12-05  5:15   ` Varghese, Vipin
  2018-12-05 17:06 ` Stephen Hemminger
  2019-01-14 12:39 ` Ananyev, Konstantin
  2 siblings, 1 reply; 5+ messages in thread
From: Varghese, Vipin @ 2018-12-05  4:37 UTC (permalink / raw)
  To: Yang, Qiming, dev; +Cc: Yang, Qiming, stable

Hi,

Should not the warning be stated for ' alloc_completion' failure

Snipped

>  				flows->num_packets * flows->categories);
>  		}
> 
> +		if (flows->last_cmplt == NULL)
> +			RTE_LOG(WARNING, MALLOC, "packet tries allocate
> failed");

Why is that we want to try this outside block?

> +
>  		/* set completion parameters and starting index for this slot */
>  		parms[n].cmplt = flows->last_cmplt;
>  		transition =
> --
> 2.9.5

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

* Re: [dpdk-dev] [PATCH] lib: add warning for NULL pointer
  2018-12-05  4:37 ` Varghese, Vipin
@ 2018-12-05  5:15   ` Varghese, Vipin
  0 siblings, 0 replies; 5+ messages in thread
From: Varghese, Vipin @ 2018-12-05  5:15 UTC (permalink / raw)
  To: Varghese, Vipin, Yang, Qiming, dev; +Cc: Yang, Qiming, stable

Do you plan to check for all iteration for ' flows->last_cmplt ' is successful?

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Varghese, Vipin
> Sent: Wednesday, December 5, 2018 10:07 AM
> To: Yang, Qiming <qiming.yang@intel.com>; dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] lib: add warning for NULL pointer
> 
> Hi,
> 
> Should not the warning be stated for ' alloc_completion' failure
> 
> Snipped
> 
> >  				flows->num_packets * flows->categories);
> >  		}
> >
> > +		if (flows->last_cmplt == NULL)
> > +			RTE_LOG(WARNING, MALLOC, "packet tries allocate
> > failed");
> 
> Why is that we want to try this outside block?
> 
> > +
> >  		/* set completion parameters and starting index for this slot */
> >  		parms[n].cmplt = flows->last_cmplt;
> >  		transition =
> > --
> > 2.9.5

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

* [dpdk-dev] [PATCH] lib: add warning for NULL pointer
@ 2018-12-05 11:55 Qiming Yang
  2018-12-05  4:37 ` Varghese, Vipin
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Qiming Yang @ 2018-12-05 11:55 UTC (permalink / raw)
  To: dev; +Cc: Qiming Yang, stable

May return NULL when manage tries for packet in acl library. So
this patch added warning for the NULL pointer return.

Fixes: 074f54ad03ee ("acl: fix build and runtime for default target")
Cc: stable@dpdk.org

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 lib/librte_acl/acl_run.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_acl/acl_run.h b/lib/librte_acl/acl_run.h
index bf7842d..6c718c0 100644
--- a/lib/librte_acl/acl_run.h
+++ b/lib/librte_acl/acl_run.h
@@ -143,6 +143,9 @@ acl_start_next_trie(struct acl_flow_data *flows, struct parms *parms, int n,
 				flows->num_packets * flows->categories);
 		}
 
+		if (flows->last_cmplt == NULL)
+			RTE_LOG(WARNING, MALLOC, "packet tries allocate failed");
+
 		/* set completion parameters and starting index for this slot */
 		parms[n].cmplt = flows->last_cmplt;
 		transition =
-- 
2.9.5

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

* Re: [dpdk-dev] [PATCH] lib: add warning for NULL pointer
  2018-12-05 11:55 [dpdk-dev] [PATCH] lib: add warning for NULL pointer Qiming Yang
  2018-12-05  4:37 ` Varghese, Vipin
@ 2018-12-05 17:06 ` Stephen Hemminger
  2019-01-14 12:39 ` Ananyev, Konstantin
  2 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2018-12-05 17:06 UTC (permalink / raw)
  To: Qiming Yang; +Cc: dev, stable

On Wed,  5 Dec 2018 19:55:31 +0800
Qiming Yang <qiming.yang@intel.com> wrote:

> May return NULL when manage tries for packet in acl library. So
> this patch added warning for the NULL pointer return.
> 
> Fixes: 074f54ad03ee ("acl: fix build and runtime for default target")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
>  lib/librte_acl/acl_run.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/librte_acl/acl_run.h b/lib/librte_acl/acl_run.h
> index bf7842d..6c718c0 100644
> --- a/lib/librte_acl/acl_run.h
> +++ b/lib/librte_acl/acl_run.h
> @@ -143,6 +143,9 @@ acl_start_next_trie(struct acl_flow_data *flows, struct parms *parms, int n,
>  				flows->num_packets * flows->categories);
>  		}
>  
> +		if (flows->last_cmplt == NULL)
> +			RTE_LOG(WARNING, MALLOC, "packet tries allocate failed");
> +
>  		/* set completion parameters and starting index for this slot */
>  		parms[n].cmplt = flows->last_cmplt;
>  		transition =

It would be better to return -ENOMEM and let caller handle the error.

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

* Re: [dpdk-dev] [PATCH] lib: add warning for NULL pointer
  2018-12-05 11:55 [dpdk-dev] [PATCH] lib: add warning for NULL pointer Qiming Yang
  2018-12-05  4:37 ` Varghese, Vipin
  2018-12-05 17:06 ` Stephen Hemminger
@ 2019-01-14 12:39 ` Ananyev, Konstantin
  2 siblings, 0 replies; 5+ messages in thread
From: Ananyev, Konstantin @ 2019-01-14 12:39 UTC (permalink / raw)
  To: Yang, Qiming, dev; +Cc: Yang, Qiming, stable



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qiming Yang
> Sent: Wednesday, December 5, 2018 11:56 AM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] lib: add warning for NULL pointer
> 
> May return NULL when manage tries for packet in acl library. So
> this patch added warning for the NULL pointer return.
> 
> Fixes: 074f54ad03ee ("acl: fix build and runtime for default target")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
>  lib/librte_acl/acl_run.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/librte_acl/acl_run.h b/lib/librte_acl/acl_run.h
> index bf7842d..6c718c0 100644
> --- a/lib/librte_acl/acl_run.h
> +++ b/lib/librte_acl/acl_run.h
> @@ -143,6 +143,9 @@ acl_start_next_trie(struct acl_flow_data *flows, struct parms *parms, int n,
>  				flows->num_packets * flows->categories);
>  		}
> 
> +		if (flows->last_cmplt == NULL)
> +			RTE_LOG(WARNING, MALLOC, "packet tries allocate failed");
> +

alloc_completion() should never retrun NULL
(unless something is totally broken).
So no need to handle such situation.
If you desire - feel free to add
RTE_ASSERT(flows->last_cmplt != NULL)
here.
Konstantin

>  		/* set completion parameters and starting index for this slot */
>  		parms[n].cmplt = flows->last_cmplt;
>  		transition =
> --
> 2.9.5

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

end of thread, other threads:[~2019-01-14 12:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-05 11:55 [dpdk-dev] [PATCH] lib: add warning for NULL pointer Qiming Yang
2018-12-05  4:37 ` Varghese, Vipin
2018-12-05  5:15   ` Varghese, Vipin
2018-12-05 17:06 ` Stephen Hemminger
2019-01-14 12:39 ` Ananyev, Konstantin

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).