DPDK patches and discussions
 help / color / mirror / Atom feed
From: <danat@marvell.com>
To: <jerinj@marvell.com>
Cc: <dev@dpdk.org>, <danat@marvell.com>, <lironh@marvell.com>,
	<tdu@semihalf.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] net/mvpp2: fix port max speed overflow
Date: Sun, 11 Jul 2021 16:11:43 +0300	[thread overview]
Message-ID: <20210711131143.11893-1-danat@marvell.com> (raw)

From: Dana Vardi <danat@marvell.com>

ethtool_cmd_speed return uint32 and after the arithmetic
operation in mrvl_get_max_rate func the result is out of range.

Fixes: 429c394417 ("net/mvpp2: support traffic manager")
Cc: tdu@semihalf.com
Cc: stable@dpdk.org

Signed-off-by: Dana Vardi <danat@marvell.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
---
 drivers/net/mvpp2/mrvl_tm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mvpp2/mrvl_tm.c b/drivers/net/mvpp2/mrvl_tm.c
index a3150328d9..4d75f8e915 100644
--- a/drivers/net/mvpp2/mrvl_tm.c
+++ b/drivers/net/mvpp2/mrvl_tm.c
@@ -57,7 +57,7 @@ mrvl_get_max_rate(struct rte_eth_dev *dev, uint64_t *rate)
 
 	close(fd);
 
-	*rate = ethtool_cmd_speed(&edata) * 1000 * 1000 / 8;
+	*rate = (uint64_t)ethtool_cmd_speed(&edata) * 1000 * 1000 / 8;
 
 	return 0;
 }
-- 
2.17.1


             reply	other threads:[~2021-07-11 13:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-11 13:11 danat [this message]
2021-07-12  8:01 ` Jerin Jacob

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=20210711131143.11893-1-danat@marvell.com \
    --to=danat@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=lironh@marvell.com \
    --cc=stable@dpdk.org \
    --cc=tdu@semihalf.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).