net: fec: validate the new settings in fec_enet_set_coalesce()
Subsystems (3)
Jakub Kicinski
maintainerPATCH 1/1 net: fec: validate the new settings in fec_enet_set_coalesce()
fec_enet_set_coalesce() validates the previously set params and if they are within range proceeds to apply the new ones. The new ones, however, are not validated. This seems backwards, probably a copy-paste error?
Compile tested only.
--- drivers/net/ethernet/freescale/fec_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +3 -3
@@ -2529,15 +2529,15 @@ fec_enet_set_coalesce(struct net_device *ndev, struct ethtool_coalesce *ec)return -EINVAL ; } - cycle =fec_enet_us_to_itr_clock (ndev, fep->rx_time_itr); + cycle =fec_enet_us_to_itr_clock (ndev, ec->rx_coalesce_usecs);if (cycle >0xFFFF ) {dev_err (dev,"Rx coalesced usec exceed hardware limitation\n" );return -EINVAL ; } - cycle =fec_enet_us_to_itr_clock (ndev, fep->tx_time_itr); + cycle =fec_enet_us_to_itr_clock (ndev, ec->tx_coalesce_usecs);if (cycle >0xFFFF ) { -dev_err (dev,"Rx coalesced usec exceed hardware limitation\n" ); +dev_err (dev,"Tx coalesced usec exceed hardware limitation\n" );return -EINVAL ; }
Signature · 1 line
2.24.1
From: [email protected] <[email protected]> On Behalf Of Jakub Kicinski
Quoted 9 lines
fec_enet_set_coalesce()validates the previously set params and if they are within range proceeds to apply the new ones.
The new ones, however, are not validated. This seems backwards, probably a copy-paste error?Compile tested only.
Fixes d851b47b22fc ("net: fec: add interrupt coalescence feature support")Signed-off-by Jakub Kicinski <[email protected]>
Good catch, parameters range checking doesn't impact function, so it should be copy-paste error.
Quoted 34 lines
--- drivers/net/ethernet/freescale/fec_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/net/ethernet/freescale/fec_main.c +4
-4@@ -2529,15 +2529,15 @@ fec_enet_set_coalesce(struct net_device *ndev, struct ethtool_coalesce *ec)return -EINVAL ; } - cycle =fec_enet_us_to_itr_clock (ndev, fep->rx_time_itr); + cycle =fec_enet_us_to_itr_clock (ndev, ec->rx_coalesce_usecs);if (cycle >0xFFFF ) {dev_err (dev,"Rx coalesced usec exceed hardware limitation\n");return -EINVAL ; } - cycle =fec_enet_us_to_itr_clock (ndev, fep->tx_time_itr); + cycle =fec_enet_us_to_itr_clock (ndev, ec->tx_coalesce_usecs);if (cycle >0xFFFF ) { -dev_err (dev,"Rx coalesced usec exceed hardware limitation\n"); + dev_err(dev,"Tx coalesced usec exceed hardware + limitation\n");return -EINVAL ; } --2.24.1
David Miller
maintainerFrom: Jakub Kicinski <[email protected]>
Date: Tue, 10 Mar 2020 20:36:16 -0700
Quoted 9 lines
fec_enet_set_coalesce()validates the previously set params and if they are within range proceeds to apply the new ones. The new ones, however, are not validated. This seems backwards, probably a copy-paste error?Compile tested only.
Fixes d851b47b22fc ("net: fec: add interrupt coalescence feature support")Signed-off-by Jakub Kicinski <[email protected]>
Applied and queued up for -stable, thanks.