netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: Fix features skip in for_each_netdev_feature()
@ 2022-05-04  8:09 Tariq Toukan
  2022-05-06  1:30 ` Jakub Kicinski
  2022-05-06  1:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Tariq Toukan @ 2022-05-04  8:09 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski; +Cc: netdev, Tariq Toukan, Gal Pressman

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>
---
 include/linux/netdev_features.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Hi,
Please queue to -stable >= v5.0.

diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 2c6b9e416225..7c2d77d75a88 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -169,7 +169,7 @@ enum {
 #define NETIF_F_HW_HSR_FWD	__NETIF_F(HW_HSR_FWD)
 #define NETIF_F_HW_HSR_DUP	__NETIF_F(HW_HSR_DUP)
 
-/* 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)
 {
@@ -188,7 +188,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 */
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: Fix features skip in for_each_netdev_feature()
  2022-05-04  8:09 [PATCH net] net: Fix features skip in for_each_netdev_feature() Tariq Toukan
@ 2022-05-06  1:30 ` Jakub Kicinski
  2022-05-06  1:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2022-05-06  1:30 UTC (permalink / raw)
  To: Tariq Toukan; +Cc: David S. Miller, netdev, Gal Pressman

On Wed, 4 May 2022 11:09:14 +0300 Tariq Toukan wrote:
> 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>
> ---
>  include/linux/netdev_features.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Hi,
> Please queue to -stable >= v5.0.

You can add the normal Cc: stable tags in networking these days, 
the rules were updated.

But I'll forgo doing that here since your >= 5.0 is incorrect, looks 
like the bad commit got backported to earlier stable branches.
Greg will probably do the right thing based on the Fixes tag, anyway.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: Fix features skip in for_each_netdev_feature()
  2022-05-04  8:09 [PATCH net] net: Fix features skip in for_each_netdev_feature() Tariq Toukan
  2022-05-06  1:30 ` Jakub Kicinski
@ 2022-05-06  1:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-06  1:50 UTC (permalink / raw)
  To: Tariq Toukan; +Cc: davem, kuba, netdev, gal

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 4 May 2022 11:09:14 +0300 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [net] net: Fix features skip in for_each_netdev_feature()
    https://git.kernel.org/netdev/net/c/85db6352fc8a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-06  1:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04  8:09 [PATCH net] net: Fix features skip in for_each_netdev_feature() Tariq Toukan
2022-05-06  1:30 ` Jakub Kicinski
2022-05-06  1:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).