net/mvpp2: fix port max speed overflow

Message ID 20210711131143.11893-1-danat@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series net/mvpp2: fix port max speed overflow |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-abi-testing warning Testing issues
ci/iol-testing fail Testing issues
ci/Intel-compilation fail Compilation issues
ci/intel-Testing success Testing PASS

Commit Message

danat@marvell.com July 11, 2021, 1:11 p.m. UTC
  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(-)
  

Comments

Jerin Jacob July 12, 2021, 8:01 a.m. UTC | #1
On Sun, Jul 11, 2021 at 6:41 PM <danat@marvell.com> wrote:
>
> 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>


Applied to dpdk-next-net-mrvl/for-next-net. Thanks


> ---
>  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
>
  

Patch

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;
 }