[dpdk-dev] [PATCH] lib: add warning for NULL pointer
Ananyev, Konstantin
konstantin.ananyev at intel.com
Mon Jan 14 13:39:02 CET 2019
> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Qiming Yang
> Sent: Wednesday, December 5, 2018 11:56 AM
> To: dev at dpdk.org
> Cc: Yang, Qiming <qiming.yang at intel.com>; stable at 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 at dpdk.org
>
> Signed-off-by: Qiming Yang <qiming.yang at 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
More information about the dev
mailing list