From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4FDD3A034C for ; Fri, 19 Aug 2022 20:36:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F3DBE42826; Fri, 19 Aug 2022 20:36:19 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 5C82A40A81; Fri, 19 Aug 2022 20:36:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660934174; x=1692470174; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UeoOAK7Soe4vl88lNhSup4CyhbefZVkZzk+KSWpwcCo=; b=IN9E877LHr5c1V1YonqWEFzLT6Iojvlg7dgE9s3OlhAhtRBRsj3MCdTp VNRqC5qsbS7nhie2UDtfWtoBKTJiUlr1HnOQjwZBIaViOHpSIvuDcJ3tT 9oUJIzo2gxw4soFjgqqjApEaAkQaEnJ/X9TEdRP54umVgHx98LlYp5bcO ClxEYNf7YF4NSRJYf3Jui8hXXN7BhNaqzUMpcrDupEtHFaI7u13knOsoj 1x5FxB44H0HIdLrd8XT2KvL+it/OC2uJWR2pF92/xiMqkk0jkiquBJhbT 1oPu3kXbR78AgbgqnUAE2AbsBX2VrgHbS9rQ03rQ/UwB+ZY3o+0jmQLuF Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10444"; a="319107219" X-IronPort-AV: E=Sophos;i="5.93,248,1654585200"; d="scan'208";a="319107219" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2022 11:36:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,248,1654585200"; d="scan'208";a="608296245" Received: from unknown (HELO csl-npg-qt0.la.intel.com) ([10.233.181.103]) by orsmga002.jf.intel.com with ESMTP; 19 Aug 2022 11:36:13 -0700 From: Hernan Vargas To: dev@dpdk.org, gakhil@marvell.com, trix@redhat.com Cc: nicolas.chautru@intel.com, qi.z.zhang@intel.com, Hernan Vargas , stable@dpdk.org Subject: [PATCH v2 05/37] baseband/acc100: memory leak fix Date: Fri, 19 Aug 2022 19:31:25 -0700 Message-Id: <20220820023157.189047-6-hernan.vargas@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220820023157.189047-1-hernan.vargas@intel.com> References: <20220820023157.189047-1-hernan.vargas@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Move check for undefined device before allocating queue data structure. Coverity issue: 375803, 375813, 375819, 375827, 375831 Fixes: 060e7672930 ("baseband/acc100: add queue configuration") Cc: stable@dpdk.org Signed-off-by: Hernan Vargas --- drivers/baseband/acc100/rte_acc100_pmd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c index 349b8be5c1..586d06d1b3 100644 --- a/drivers/baseband/acc100/rte_acc100_pmd.c +++ b/drivers/baseband/acc100/rte_acc100_pmd.c @@ -828,6 +828,10 @@ acc100_queue_setup(struct rte_bbdev *dev, uint16_t queue_id, struct acc100_queue *q; int16_t q_idx; + if (d == NULL) { + rte_bbdev_log(ERR, "Undefined device"); + return -ENODEV; + } /* Allocate the queue data structure. */ q = rte_zmalloc_socket(dev->device->driver->name, sizeof(*q), RTE_CACHE_LINE_SIZE, conf->socket); @@ -835,10 +839,6 @@ acc100_queue_setup(struct rte_bbdev *dev, uint16_t queue_id, rte_bbdev_log(ERR, "Failed to allocate queue memory"); return -ENOMEM; } - if (d == NULL) { - rte_bbdev_log(ERR, "Undefined device"); - return -ENODEV; - } q->d = d; q->ring_addr = RTE_PTR_ADD(d->sw_rings, (d->sw_ring_size * queue_id)); -- 2.37.1