All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Qiming Yang <qiming.yang@intel.com>
Cc: dev@dpdk.org, stable@dpdk.org
Subject: Re: [PATCH] lib: add warning for NULL pointer
Date: Wed, 5 Dec 2018 09:06:13 -0800	[thread overview]
Message-ID: <20181205090613.2aee7fed@xeon-e3> (raw)
In-Reply-To: <20181205115531.17073-1-qiming.yang@intel.com>

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.

  parent reply	other threads:[~2018-12-05 17:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-05 11:55 [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 [this message]
2019-01-14 12:39 ` Ananyev, Konstantin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181205090613.2aee7fed@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=qiming.yang@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.