From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 597C799F5 for ; Mon, 31 Jul 2017 21:33:17 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id D020220833; Mon, 31 Jul 2017 15:33:16 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Mon, 31 Jul 2017 15:33:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=kiJR3ZOMBoEqLRK i98BY4j/YW08Caz1QRLLBalVh9pA=; b=Z4sNFcyEwqfOUc7vPOjB7fBGPROEpjt 2LM/vdj+Gi7Eiaa7LyMPsCTGqwiD/BdifDTtvlXHc+cf8t0f3BQQ/IO8GvY2HAMq k9b1n9v9S+gaL98SCyknWqgpN0rnUCnKhjmAJGFyqE8euXdKgdiyFJYu6qR9CC03 j05YkQBOrJyw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=kiJR3ZOMBoEqLRKi98BY4j/YW08Caz1QRLLBalVh9pA=; b=CyH4jsq7 pItYZMPSB/FCTezoyzsebAF6oj5loryuqQ+AMiTPWryNwVcApav7fk0LCswhPkOE Y7AtZlIFea6Bbb8SJWS99kJlmyAi4HFMLBKDQtY6kO96hBU60VhnpntifxDqnWOr 6thDle4rMHaOLkUIsyzO0454p5VIdTaG21IisCMacTQ8XcHSMsdTzfozPnS327WP 1k+NxVzJoSCqpGtzcVSUYil+u3qjqlEPFuyA5Fcnm5cgr39VPLxbwXsurJt76K50 gnIc1iZeNJJfBz+cB25zIVXQmwHzaRLikvrTEMuwxTWZoZ8poantdBAhrcWfg/0Q M7mh3eUw4l3ubw== X-ME-Sender: X-Sasl-enc: CXzmJUymMwFmKTAZg+Du9dd4kt45Rx6nOZ80crI5VPE1 1501529596 Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 6EA247E4ED; Mon, 31 Jul 2017 15:33:16 -0400 (EDT) From: Thomas Monjalon To: Pablo de Lara Cc: sergio.gonzalez.monroy@intel.com, dev@dpdk.org Date: Mon, 31 Jul 2017 21:33:15 +0200 Message-ID: <7230298.g0yYOUbsxP@xps> In-Reply-To: <20170731091817.41505-1-pablo.de.lara.guarch@intel.com> References: <20170731023050.28956-1-pablo.de.lara.guarch@intel.com> <20170731091817.41505-1-pablo.de.lara.guarch@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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: Mon, 31 Jul 2017 19:33:17 -0000 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(-) 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.