summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTariq Toukan <tariqt@nvidia.com>2022-05-04 11:09:14 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-05-18 10:23:42 +0200
commite2cdde89d253d740ba58e5ba5375855723ddca27 (patch)
tree5ab2d2e4c04d0847d99ab4ea3474fc778f66b249 /include
parentc420d66047068bd5a7e3d7c82d5a16a91f437513 (diff)
net: Fix features skip in for_each_netdev_feature()
[ Upstream commit 85db6352fc8a158a893151baa1716463d34a20d0 ] The find_next_netdev_feature() macro gets the "remaining length", not bit index. Passing "bit - 1" for the following iteration is wrong as it skips the adjacent bit. Pass "bit" instead. Fixes: 3b89ea9c5902 ("net: Fix for_each_netdev_feature on Big endian") Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Gal Pressman <gal@nvidia.com> Link: https://lore.kernel.org/r/20220504080914.1918-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/netdev_features.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index f96b7f8d82e5..e2a92697a663 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -158,7 +158,7 @@ enum {
#define NETIF_F_GSO_FRAGLIST __NETIF_F(GSO_FRAGLIST)
#define NETIF_F_HW_MACSEC __NETIF_F(HW_MACSEC)
-/* Finds the next feature with the highest number of the range of start till 0.
+/* Finds the next feature with the highest number of the range of start-1 till 0.
*/
static inline int find_next_netdev_feature(u64 feature, unsigned long start)
{
@@ -177,7 +177,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
for ((bit) = find_next_netdev_feature((mask_addr), \
NETDEV_FEATURE_COUNT); \
(bit) >= 0; \
- (bit) = find_next_netdev_feature((mask_addr), (bit) - 1))
+ (bit) = find_next_netdev_feature((mask_addr), (bit)))
/* Features valid for ethtool to change */
/* = all defined minus driver/device-class-related */