From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>,
danielx.t.mrzyglod@intel.com, stable@dpdk.org,
Chaoyong He <chaoyong.he@corigine.com>,
Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH v2] net/bonding: fix illegal memory accesses
Date: Wed, 1 Nov 2023 10:19:59 +0800 [thread overview]
Message-ID: <20231101021959.2213518-1-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20231010062304.205933-3-chaoyong.he@corigine.com>
From: Long Wu <long.wu@corigine.com>
CI found that overrunning array of 32 2-byte elements at
element index 65535 (byte offset 131071) by dereferencing
pointer "members + agg_new_idx".
Coverity issue: 403099
Fixes: 6d72657 ("net/bonding: add other aggregator modes")
Cc: danielx.t.mrzyglod@intel.com
Cc: stable@dpdk.org
Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
v2:
* Modify the logic of 'max_index()'.
---
drivers/net/bonding/rte_eth_bond_8023ad.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index 677067870f..79f1b3f1a0 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -654,12 +654,9 @@ tx_machine(struct bond_dev_private *internals, uint16_t member_id)
}
static uint16_t
-max_index(uint64_t *a, int n)
+max_index(uint64_t *a, uint16_t n)
{
- if (n <= 0)
- return -1;
-
- int i, max_i = 0;
+ uint16_t i, max_i = 0;
uint64_t max = a[0];
for (i = 1; i < n; ++i) {
--
2.39.1
next prev parent reply other threads:[~2023-11-01 2:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 6:23 [PATCH 0/3] Fix three coverity issues of bond PMD Chaoyong He
2023-10-10 6:23 ` [PATCH 1/3] app/test: fix control flow issue Chaoyong He
2023-10-31 14:51 ` Ferruh Yigit
2023-10-10 6:23 ` [PATCH 2/3] net/bonding: fix illegal memory accesses Chaoyong He
2023-10-31 14:51 ` Ferruh Yigit
2023-11-01 2:19 ` Chaoyong He [this message]
2023-11-01 15:38 ` [PATCH v2] " Ferruh Yigit
2023-10-10 6:23 ` [PATCH 3/3] app/test: fix checking return value Chaoyong He
2023-10-31 14:52 ` Ferruh Yigit
2023-10-31 14:52 ` [PATCH 0/3] Fix three coverity issues of bond PMD Ferruh Yigit
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=20231101021959.2213518-1-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=danielx.t.mrzyglod@intel.com \
--cc=dev@dpdk.org \
--cc=long.wu@corigine.com \
--cc=oss-drivers@corigine.com \
--cc=peng.zhang@corigine.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).