net/mvpp2: fix port max speed overflow
PATCH 1/1 net/mvpp2: fix port max speed overflow
From: Dana Vardi <[email protected]>
ethtool_cmd_speed return uint32 and after the arithmetic operation in mrvl_get_max_rate func the result is out of range.
Signed-off-by Dana Vardi <[email protected]>
Reviewed-by Liron Himi <[email protected]>
--- drivers/net/mvpp2/mrvl_tm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mvpp2/mrvl_tm.c +1 -1
@@ -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 ; }
Signature · 1 line
2.17.1
Jerin Jacob
AppliedQuoted 6 lines · On Sun, Jul 11, 2021 at 6:41 PM <[email protected]> wrote:
From: Dana Vardi <[email protected]>
ethtool_cmd_speedreturn uint32 and after the arithmetic operation inmrvl_get_max_ratefunc the result is out of range.
Quoted 6 lines
Signed-off-by Dana Vardi <[email protected]>Reviewed-by Liron Himi <[email protected]>
Applied to dpdk-next-net-mrvl/for-next-net. Thanks
Quoted 20 lines
--- drivers/net/mvpp2/mrvl_tm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/mvpp2/mrvl_tm.c +1
-2@@ -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