From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH] lib: add warning for NULL pointer Date: Wed, 5 Dec 2018 09:06:13 -0800 Message-ID: <20181205090613.2aee7fed@xeon-e3> References: <20181205115531.17073-1-qiming.yang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, stable@dpdk.org To: Qiming Yang Return-path: Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id C1C7B1F28 for ; Wed, 5 Dec 2018 18:06:16 +0100 (CET) Received: by mail-pf1-f194.google.com with SMTP id g62so10300032pfd.12 for ; Wed, 05 Dec 2018 09:06:16 -0800 (PST) In-Reply-To: <20181205115531.17073-1-qiming.yang@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, 5 Dec 2018 19:55:31 +0800 Qiming Yang 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 > --- > 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.