Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ethtool: rename local variable max -> curr

ethtool_set_channels() validates the config against driver's max
settings. It retrieves the current config and stores it in a
variable called max. This was okay when only max settings were
accessed but we will soon want to access current settings as
well, so calling the entire structure max makes the code less
readable.

While at it drop unnecessary parenthesis.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>

authored by

Jakub Kicinski and committed by
Daniel Borkmann
b8c8a2e2 c9b47cc1

+6 -6
+6 -6
net/core/ethtool.c
··· 1655 1655 static noinline_for_stack int ethtool_set_channels(struct net_device *dev, 1656 1656 void __user *useraddr) 1657 1657 { 1658 - struct ethtool_channels channels, max = { .cmd = ETHTOOL_GCHANNELS }; 1658 + struct ethtool_channels channels, curr = { .cmd = ETHTOOL_GCHANNELS }; 1659 1659 u32 max_rx_in_use = 0; 1660 1660 1661 1661 if (!dev->ethtool_ops->set_channels || !dev->ethtool_ops->get_channels) ··· 1664 1664 if (copy_from_user(&channels, useraddr, sizeof(channels))) 1665 1665 return -EFAULT; 1666 1666 1667 - dev->ethtool_ops->get_channels(dev, &max); 1667 + dev->ethtool_ops->get_channels(dev, &curr); 1668 1668 1669 1669 /* ensure new counts are within the maximums */ 1670 - if ((channels.rx_count > max.max_rx) || 1671 - (channels.tx_count > max.max_tx) || 1672 - (channels.combined_count > max.max_combined) || 1673 - (channels.other_count > max.max_other)) 1670 + if (channels.rx_count > curr.max_rx || 1671 + channels.tx_count > curr.max_tx || 1672 + channels.combined_count > curr.max_combined || 1673 + channels.other_count > curr.max_other) 1674 1674 return -EINVAL; 1675 1675 1676 1676 /* ensure the new Rx count fits within the configured Rx flow