From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ananyev, Konstantin" Subject: Re: [PATCH] lib: add warning for NULL pointer Date: Mon, 14 Jan 2019 12:39:02 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258010D903A01@irsmsx105.ger.corp.intel.com> References: <20181205115531.17073-1-qiming.yang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "Yang, Qiming" , "stable@dpdk.org" To: "Yang, Qiming" , "dev@dpdk.org" Return-path: In-Reply-To: <20181205115531.17073-1-qiming.yang@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----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 ; stable@dpdk.org > Subject: [dpdk-dev] [PATCH] lib: add warning for NULL pointer >=20 > May return NULL when manage tries for packet in acl library. So > this patch added warning for the NULL pointer return. >=20 > Fixes: 074f54ad03ee ("acl: fix build and runtime for default target") > Cc: stable@dpdk.org >=20 > Signed-off-by: Qiming Yang > --- > lib/librte_acl/acl_run.h | 3 +++ > 1 file changed, 3 insertions(+) >=20 > 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, stru= ct parms *parms, int n, > flows->num_packets * flows->categories); > } >=20 > + if (flows->last_cmplt =3D=3D 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 !=3D NULL) here. Konstantin > /* set completion parameters and starting index for this slot */ > parms[n].cmplt =3D flows->last_cmplt; > transition =3D > -- > 2.9.5