From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 0DFF47D5E for ; Tue, 1 Aug 2017 09:12:10 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Aug 2017 00:12:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,305,1498546800"; d="scan'208";a="118022872" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga002.jf.intel.com with ESMTP; 01 Aug 2017 00:10:15 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.133]) by IRSMSX154.ger.corp.intel.com ([169.254.12.76]) with mapi id 14.03.0319.002; Tue, 1 Aug 2017 08:10:14 +0100 From: "De Lara Guarch, Pablo" To: Thomas Monjalon CC: "Gonzalez Monroy, Sergio" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2] cryptodev: fix NULL pointer dereference Thread-Index: AQHTCjPmuZ7/X/bVFE6rUfYRK1+VjKJvFdsA Date: Tue, 1 Aug 2017 07:10:14 +0000 Message-ID: References: <20170731023050.28956-1-pablo.de.lara.guarch@intel.com> <20170731091817.41505-1-pablo.de.lara.guarch@intel.com> <7230298.g0yYOUbsxP@xps> In-Reply-To: <7230298.g0yYOUbsxP@xps> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] cryptodev: fix NULL pointer dereference X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 07:12:11 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon > Sent: Monday, July 31, 2017 8:33 PM > To: De Lara Guarch, Pablo > Cc: Gonzalez Monroy, Sergio ; > dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2] cryptodev: fix NULL pointer dereferenc= e >=20 > 31/07/2017 11:18, Pablo de Lara: > > When register a crypto driver, a cryptodev driver structure was being > > allocated, using malloc. > > Since this call may fail, it is safer to allocate this memory > > statically in each PMD, so driver registration will never fail. > > > > Coverity issue: 158645 > > > > Fixes: 7a364faef185 ("cryptodev: remove crypto device type > > enumeration") > > > > Signed-off-by: Pablo de Lara > > --- > > > > Changes in v2: > > > > - Allocate statically the cryptodev driver structure, > > instead of using malloc, that can potentially fail. > > > > drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 5 ++++- > > drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 6 +++++- > > drivers/crypto/armv8/rte_armv8_pmd.c | 9 ++++++--- > > drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 5 ++++- > > drivers/crypto/kasumi/rte_kasumi_pmd.c | 5 ++++- > > drivers/crypto/null/null_crypto_pmd.c | 5 ++++- > > drivers/crypto/openssl/rte_openssl_pmd.c | 5 ++++- > > drivers/crypto/qat/rte_qat_cryptodev.c | 7 +++++-- > > drivers/crypto/scheduler/scheduler_pmd.c | 5 ++++- > > drivers/crypto/snow3g/rte_snow3g_pmd.c | 5 ++++- > > drivers/crypto/zuc/rte_zuc_pmd.c | 5 ++++- > > lib/librte_cryptodev/rte_cryptodev.c | 18 +++++------------ > > lib/librte_cryptodev/rte_cryptodev.h | 20 ------------------- > > lib/librte_cryptodev/rte_cryptodev_pmd.h | 30 > +++++++++++++++++++++++++++++ > > 14 files changed, 83 insertions(+), 47 deletions(-) >=20 > This is a big change for a small/unlikely issue. > The main benefit of this patch is an allocation cleanup. > I think it is better to wait 17.11 cycle to integrate it. Makes sense, Thomas. Thanks, Pablo