From mboxrd@z Thu Jan 1 00:00:00 1970 From: "De Lara Guarch, Pablo" Subject: Re: [PATCH] cryptodev: fix NULL pointer dereference Date: Tue, 1 Aug 2017 07:09:51 +0000 Message-ID: References: <20170731023050.28956-1-pablo.de.lara.guarch@intel.com> <8040895.veDesW7eHG@xps> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , "Gonzalez Monroy, Sergio" , "Doherty, Declan" To: Thomas Monjalon Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 132099B57 for ; Tue, 1 Aug 2017 09:13:03 +0200 (CEST) In-Reply-To: <8040895.veDesW7eHG@xps> 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" Hi Thomas, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon > Sent: Monday, July 31, 2017 4:23 PM > To: De Lara Guarch, Pablo > Cc: dev@dpdk.org; Gonzalez Monroy, Sergio > ; Doherty, Declan > > Subject: Re: [dpdk-dev] [PATCH] cryptodev: fix NULL pointer dereference >=20 > 31/07/2017 14:32, Sergio Gonzalez Monroy: > > On 31/07/2017 03:30, Pablo de Lara wrote: > > > --- a/lib/librte_cryptodev/rte_cryptodev.c > > > +++ b/lib/librte_cryptodev/rte_cryptodev.c > > > @@ -1404,6 +1404,12 @@ rte_cryptodev_allocate_driver(const struct > rte_driver *drv) > > > struct cryptodev_driver *driver; > > > > > > driver =3D malloc(sizeof(*driver)); > > > + > > > + if (driver =3D=3D NULL) > > > + rte_exit(EXIT_FAILURE, > > > + "Could not allocate memory for crypto driver %u\n", > > > + nb_drivers); > > > + > > > driver->driver =3D drv; > > > driver->id =3D nb_drivers; > > > > > > > Acked-by: Sergio Gonzalez Monroy >=20 > NACK rte_exit/rte_panic in libraries. I have sent a v2 that allocates statically the structure, instead of calling malloc, so no rte_exit is required. Thanks, Pablo