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 82AB9A0544; Wed, 6 Jul 2022 23:31:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 885C640E50; Wed, 6 Jul 2022 23:31:49 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id C78AF40691; Wed, 6 Jul 2022 23:31:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657143107; x=1688679107; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=V2dMBy33h9JSN/w2ajFnWhLfF89beD2NNE1LP1bt2r0=; b=iVizJmYPIbLo0oF6h2Hsp3kFmP/FoH1egN7bKEyixRNzCzX/MMQcuWn8 O9JJeatJaWTQ37ae94NsNY14NML+bYGctKBZ8fdtaX3Vbn2KUeE53HWMw +vwmNWr7S8Nc6gnhpI+pHjDlg5yYSQo3oIAmcNGRRFdsi05IS/8U6okaD tt4KMWTcGKI/nwq0fBFUtUWhJ38psCtmkDh6yR1PceSBTYXvnh8zh+W1Y J2P/MrOFZjr3iG12GKGFnu3VUzTNLdQtH5am7CdAGEdxkM2MofhRf4X2J b4oc9giqmEeTRy4fZraCvBOgBjSfHPVX/75FmZDdkU/mRxb6yhuQzp+ag A==; X-IronPort-AV: E=McAfee;i="6400,9594,10400"; a="266902241" X-IronPort-AV: E=Sophos;i="5.92,250,1650956400"; d="scan'208";a="266902241" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2022 14:31:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,250,1650956400"; d="scan'208";a="650852293" Received: from txanpdk03.an.intel.com ([10.123.117.78]) by fmsmga008.fm.intel.com with ESMTP; 06 Jul 2022 14:31:45 -0700 From: Timothy McDaniel To: jerinj@marvell.com Cc: jerinjacobk@gmail.com, dev@dpdk.org, stable@dpdk.org Subject: [PATCH 1/2] event/dlb2: fix cq_weight array overflow Date: Wed, 6 Jul 2022 16:31:40 -0500 Message-Id: <20220706213141.2374006-2-timothy.mcdaniel@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220706213141.2374006-1-timothy.mcdaniel@intel.com> References: <20220706213141.2374006-1-timothy.mcdaniel@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The cq_weight array must be sized for the maximum number of eventdev ports, not the the maximum number of DLB2 load balanced ports. This commit fixes the above array sizing bug and resultant coverity warning. Coverity issue: 379234 Fixes: ffa46fc4a2b5 ("event/dlb2: support CQ weight") Cc: stable@dpdk.org Signed-off-by: Timothy McDaniel --- drivers/event/dlb2/dlb2.c | 4 ++-- drivers/event/dlb2/dlb2_priv.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index 26af75beb8..93bf215762 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -137,7 +137,7 @@ set_cq_weight(const char *key __rte_unused, */ if (sscanf(value, "all:%d", &weight) == 1) { first = 0; - last = DLB2_MAX_NUM_LDB_PORTS - 1; + last = DLB2_MAX_NUM_PORTS_ALL - 1; } else if (sscanf(value, "%d-%d:%d", &first, &last, &weight) == 3) { /* we have everything we need */ } else if (sscanf(value, "%d:%d", &first, &weight) == 2) { @@ -148,7 +148,7 @@ set_cq_weight(const char *key __rte_unused, } if (first > last || first < 0 || - last >= DLB2_MAX_NUM_LDB_PORTS) { + last >= DLB2_MAX_NUM_PORTS_ALL) { DLB2_LOG_ERR("Error parsing ldb port qe weight arg, invalid port value\n"); return -EINVAL; } diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h index 1edea83a5b..db431f7d8b 100644 --- a/drivers/event/dlb2/dlb2_priv.h +++ b/drivers/event/dlb2/dlb2_priv.h @@ -641,7 +641,7 @@ struct dlb2_qid_depth_thresholds { }; struct dlb2_cq_weight { - int limit[DLB2_MAX_NUM_LDB_PORTS]; + int limit[DLB2_MAX_NUM_PORTS_ALL]; }; struct dlb2_port_cos { -- 2.25.1