DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Zhaohui (zhaohui, Polestar)" <zhaohui8@huawei.com>
To: "dev@dpdk.org" <dev@dpdk.org>, Chas Williams <3chas3@gmail.com>,
	"Ferruh Yigit" <ferruh.yigit@intel.com>
Cc: chenchanghu <chenchanghu@huawei.com>,
	"stable@dpdk.org" <stable@dpdk.org>,
	 wangyunjian <wangyunjian@huawei.com>
Subject: [dpdk-dev]  [PATCH] net/bonding: fix Segfault when eal thread executing nic‘s lsc event for mode 4
Date: Wed, 20 Mar 2019 13:11:11 +0000	[thread overview]
Message-ID: <E107353650813740A09E8EDB2EFDB9C235BE6DCC@dggeml529-mbx.china.huawei.com> (raw)
Message-ID: <20190320131111.fuxUgdOLKDwCYnJYgmf98kM6zttMzaHI_KllKjxU8Kc@z> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 2060 bytes --]

Hi£º
         When the number of slave slave devices exceeds 8, it will cause the array subscript to cross the boundary.
         According to the suggestions, Modified array subscript to RTE_MAX_ETHPORTS, and Changed uint8_t to uint16_t. Something like this:

From 51a081ea88cca1599d458d8d1c7d9605a6eb3352 Mon Sep 17 00:00:00 2001
From: zhaohui8 <zhaohui8@huawei.com>
Date: Wed, 20 Mar 2019 20:17:27 +0800
Subject: [PATCH] net/bonding: fix Segfault when eal thread executing nic¡®s lsc event for mode 4

Change-Id: I6d800a3adf5ca51f295b607de879bcb0ccc20004
---
drivers/net/bonding/rte_eth_bond_8023ad.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index dd847c6..4d99239 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -638,7 +638,7 @@
       SM_FLAG_CLR(port, NTT);
}
-static uint8_t
+static uint16_t
max_index(uint64_t *a, int n)
{
       if (n <= 0)
@@ -664,15 +664,15 @@
  * @param port_pos                       Port to assign.
  */
static void
-selection_logic(struct bond_dev_private *internals, uint8_t slave_id)
+selection_logic(struct bond_dev_private *internals, uint16_t slave_id)
{
       struct port *agg, *port;
       uint16_t slaves_count, new_agg_id, i, j = 0;
       uint16_t *slaves;
-        uint64_t agg_bandwidth[8] = {0};
-        uint64_t agg_count[8] = {0};
+       uint64_t agg_bandwidth[RTE_MAX_ETHPORTS] = {0};
+       uint64_t agg_count[RTE_MAX_ETHPORTS] = {0};
       uint16_t default_slave = 0;
-        uint8_t mode_count_id, mode_band_id;
+       uint16_t mode_count_id, mode_band_id;
       struct rte_eth_link link_info;
        slaves = internals->active_slaves;
@@ -806,7 +806,7 @@
       struct ether_addr slave_addr;
       struct rte_mbuf *lacp_pkt = NULL;
-        uint8_t i, slave_id;
+       uint16_t i, slave_id;

        /* Update link status on each port */
--
1.9.5.msysgit.0


             reply	other threads:[~2019-03-20 13:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 13:11 Zhaohui (zhaohui, Polestar) [this message]
2019-03-20 13:11 ` Zhaohui (zhaohui, Polestar)
2019-03-20 13:39 ` David Marchand
2019-03-20 13:39   ` David Marchand
2019-03-20 13:54   ` [dpdk-dev] 答复: " Zhaohui (zhaohui, Polestar)
2019-03-20 13:54     ` Zhaohui (zhaohui, Polestar)
2019-03-20 14:21     ` [dpdk-dev] " David Marchand
2019-03-20 14:21       ` David Marchand
  -- strict thread matches above, loose matches on Subject: below --
2019-03-06  3:42 Zhaohui (zhaohui, Polestar)
2019-03-19 17:37 ` Ferruh Yigit
2019-03-19 17:37   ` Ferruh Yigit
2019-03-19 18:00   ` Chas Williams
2019-03-19 18:00     ` Chas Williams

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=E107353650813740A09E8EDB2EFDB9C235BE6DCC@dggeml529-mbx.china.huawei.com \
    --to=zhaohui8@huawei.com \
    --cc=3chas3@gmail.com \
    --cc=chenchanghu@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=stable@dpdk.org \
    --cc=wangyunjian@huawei.com \
    /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).