From: Timothy McDaniel <timothy.mcdaniel@intel.com>
To: timothy.mcdaniel@intel.com
Cc: dev@dpdk.org, jerinj@marvell.com, jerinjacobk@gmail.com, stable@dpdk.org
Subject: [PATCH v2 1/2] event/dlb2: fix cq_weight array overflow
Date: Wed, 6 Jul 2022 16:46:27 -0500 [thread overview]
Message-ID: <20220706214628.2375117-2-timothy.mcdaniel@intel.com> (raw)
In-Reply-To: <20220706214628.2375117-1-timothy.mcdaniel@intel.com>
The cq_weight array must be sized for the maximum number
of eventdev ports, not 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 <timothy.mcdaniel@intel.com>
---
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
next prev parent reply other threads:[~2022-07-06 21:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220706213141.2374006-1-timothy.mcdaniel@intel.com>
2022-07-06 21:31 ` [PATCH " Timothy McDaniel
2022-07-06 21:46 ` [PATCH v2 0/2] DLB2: cq_weight fixes Timothy McDaniel
2022-07-06 21:46 ` Timothy McDaniel [this message]
2022-07-06 21:46 ` [PATCH v2 2/2] event/dlb2: improve cq_weight error messages Timothy McDaniel
2022-07-08 14:26 ` [PATCH v2 0/2] DLB2: cq_weight fixes Thomas Monjalon
2022-07-08 15:02 ` McDaniel, Timothy
2022-07-11 20:30 ` Thomas Monjalon
2022-07-11 20:33 ` McDaniel, Timothy
2022-07-06 21:31 ` [PATCH 2/2] event/dlb2: improve cq_weight error messages Timothy McDaniel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220706214628.2375117-2-timothy.mcdaniel@intel.com \
--to=timothy.mcdaniel@intel.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=jerinjacobk@gmail.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).