[v2,1/2] event/dlb2: fix cq_weight array overflow
Checks
Commit Message
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(-)
@@ -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;
}
@@ -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 {