From patchwork Fri Apr 5 13:45:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 52342 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9DD761B513; Fri, 5 Apr 2019 15:45:24 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 073E11B50E; Fri, 5 Apr 2019 15:45:19 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 06:45:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,312,1549958400"; d="scan'208";a="140383650" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by fmsmga007.fm.intel.com with ESMTP; 05 Apr 2019 06:45:17 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , stable@dpdk.org, Maxime Coquelin , Tiwei Bie , Zhihong Wang Date: Fri, 5 Apr 2019 14:45:07 +0100 Message-Id: <20190405134511.49066-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190405134511.49066-1-bruce.richardson@intel.com> References: <20190405134511.49066-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 1/5] examples/vhost_scsi: fix header check for meson build 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The header check for the example app was looking for virtio_scsi.h without the "linux/" prefix, which meant it was never getting found when it should have been. Fixes: 8d47a753b7cb ("examples/vhost_scsi: disable build if missing dependency") CC: stable@dpdk.org CC: Maxime Coquelin CC: Tiwei Bie CC: Zhihong Wang Signed-off-by: Bruce Richardson --- examples/vhost_scsi/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/vhost_scsi/meson.build b/examples/vhost_scsi/meson.build index ca1248023..e00a7dab1 100644 --- a/examples/vhost_scsi/meson.build +++ b/examples/vhost_scsi/meson.build @@ -10,7 +10,7 @@ if host_machine.system() != 'linux' build = false endif -if not cc.has_header('virtio_scsi.h') +if not cc.has_header('linux/virtio_scsi.h') build = false endif From patchwork Fri Apr 5 13:45:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 52343 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E46771B51A; Fri, 5 Apr 2019 15:45:29 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id A469A1B512; Fri, 5 Apr 2019 15:45:27 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 06:45:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,312,1549958400"; d="scan'208";a="140383679" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by fmsmga007.fm.intel.com with ESMTP; 05 Apr 2019 06:45:25 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , stable@dpdk.org, Maxime Coquelin , Tiwei Bie , Zhihong Wang Date: Fri, 5 Apr 2019 14:45:08 +0100 Message-Id: <20190405134511.49066-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190405134511.49066-1-bruce.richardson@intel.com> References: <20190405134511.49066-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 2/5] examples/vhost_scsi: fix missing NULL-check for parameter 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Coverity points out that there is a check in the main thread loop for the ctrlr->bdev being NULL, but by that stage the pointer has already been dereferenced. Therefore, for safety, before we enter the loop do an initial check on the parameter structure. Coverity issue: 158657 Fixes: db75c7af19bb ("examples/vhost_scsi: introduce a new sample app") CC: stable@dpdk.org CC: Maxime Coquelin CC: Tiwei Bie CC: Zhihong Wang Signed-off-by: Bruce Richardson --- examples/vhost_scsi/vhost_scsi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/vhost_scsi/vhost_scsi.c b/examples/vhost_scsi/vhost_scsi.c index 2908ff68b..a6465d089 100644 --- a/examples/vhost_scsi/vhost_scsi.c +++ b/examples/vhost_scsi/vhost_scsi.c @@ -285,6 +285,12 @@ ctrlr_worker(void *arg) cpu_set_t cpuset; pthread_t thread; + if (ctrlr == NULL || ctrlr->bdev == NULL) { + fprintf(stdout, "%s: Error, invalid argument passed to worker thread\n", + __func__); + return NULL; + } + thread = pthread_self(); CPU_ZERO(&cpuset); CPU_SET(0, &cpuset); From patchwork Fri Apr 5 13:45:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 52344 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1B11B1B519; Fri, 5 Apr 2019 15:45:34 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 0F9151B511; Fri, 5 Apr 2019 15:45:31 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 06:45:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,312,1549958400"; d="scan'208";a="140383701" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by fmsmga007.fm.intel.com with ESMTP; 05 Apr 2019 06:45:30 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , qi.z.zhang@intel.com, stable@dpdk.org Date: Fri, 5 Apr 2019 14:45:09 +0100 Message-Id: <20190405134511.49066-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190405134511.49066-1-bruce.richardson@intel.com> References: <20190405134511.49066-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 3/5] net/i40e: fix dereference before NULL check in mbuf release 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Coverity flags that the txq variable is used before it's checked for NULL. Coverity issue: 195023 Fixes: 24853544c84c ("net/i40e: fix mbuf free in vector Tx") Cc: qi.z.zhang@intel.com CC: stable@dpdk.org Signed-off-by: Bruce Richardson Acked-By: Rami Rosen --- drivers/net/i40e/i40e_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 8f727fae6..5ce85eb52 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -2423,13 +2423,13 @@ i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq) struct rte_eth_dev *dev; uint16_t i; - dev = &rte_eth_devices[txq->port_id]; - if (!txq || !txq->sw_ring) { PMD_DRV_LOG(DEBUG, "Pointer to rxq or sw_ring is NULL"); return; } + dev = &rte_eth_devices[txq->port_id]; + /** * vPMD tx will not set sw_ring's mbuf to NULL after free, * so need to free remains more carefully. From patchwork Fri Apr 5 13:45:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 52345 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C3ADB1B529; Fri, 5 Apr 2019 15:45:39 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id BB8281B4F4; Fri, 5 Apr 2019 15:45:36 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 06:45:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,312,1549958400"; d="scan'208";a="140383749" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by fmsmga007.fm.intel.com with ESMTP; 05 Apr 2019 06:45:34 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , wei.dai@intel.com, stable@dpdk.org, Bernard Iremonger , Wenzhuo Lu Date: Fri, 5 Apr 2019 14:45:10 +0100 Message-Id: <20190405134511.49066-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190405134511.49066-1-bruce.richardson@intel.com> References: <20190405134511.49066-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 4/5] app/testpmd: fix variable use before NULL check 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The value returned from rte_eth_dev_tx_offload_name() function is used for string comparison before being checked for NULL. Move the NULL check up to be done first. Coverity issue: 279438 Fixes: c73a9071877a ("app/testpmd: add commands to test new offload API") Cc: wei.dai@intel.com Cc: stable@dpdk.org Cc: Bernard Iremonger Cc: Wenzhuo Lu Signed-off-by: Bruce Richardson Acked-by: Rami Rosen --- app/test-pmd/cmdline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index ee50e4566..2155ff241 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -18306,13 +18306,13 @@ search_tx_offload(const char *name) single_offload = 1; for (bit = 0; bit < sizeof(single_offload) * CHAR_BIT; bit++) { single_name = rte_eth_dev_tx_offload_name(single_offload); + if (single_name == NULL) + break; if (!strcasecmp(single_name, name)) { found = 1; break; } else if (!strcasecmp(single_name, "UNKNOWN")) break; - else if (single_name == NULL) - break; single_offload <<= 1; } From patchwork Fri Apr 5 13:45:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 52346 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 790301B537; Fri, 5 Apr 2019 15:45:46 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id ADBBA1B525; Fri, 5 Apr 2019 15:45:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 06:45:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,312,1549958400"; d="scan'208";a="140383769" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by fmsmga007.fm.intel.com with ESMTP; 05 Apr 2019 06:45:37 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , stable@dpdk.org, zijie.pan@6wind.com, Beilei Xing , Qi Zhang Date: Fri, 5 Apr 2019 14:45:11 +0100 Message-Id: <20190405134511.49066-6-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190405134511.49066-1-bruce.richardson@intel.com> References: <20190405134511.49066-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 5/5] net/i40e: fix dereference before check when getting EEPROM 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" As flagged by coverity, the "info" structure is being explicitly dereferenced before being checked later for a NULL value. Coverity issue: 277241 Fixes: 98e60c0d43f1 ("net/i40e: add module EEPROM callbacks for i40e") CC: stable@dpdk.org Cc: zijie.pan@6wind.com CC: Beilei Xing CC: Qi Zhang Signed-off-by: Bruce Richardson Acked-By: Rami Rosen --- drivers/net/i40e/i40e_ethdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index b031bf4c6..6450af016 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -11893,16 +11893,17 @@ static int i40e_get_module_eeprom(struct rte_eth_dev *dev, struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); bool is_sfp = false; i40e_status status; - uint8_t *data = info->data; + uint8_t *data; uint32_t value = 0; uint32_t i; - if (!info || !info->length || !data) + if (!info || !info->length || !info->data) return -EINVAL; if (hw->phy.link_info.module_type[0] == I40E_MODULE_TYPE_SFP) is_sfp = true; + data = info->data; for (i = 0; i < info->length; i++) { u32 offset = i + info->offset; u32 addr = is_sfp ? I40E_I2C_EEPROM_DEV_ADDR : 0;