* [PATCH v3] ethtool: fix ethnl_bitmap32_not_zero() bit interval semantics
@ 2026-05-11 1:43 Chenguang Zhao
2026-05-13 3:45 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Chenguang Zhao @ 2026-05-11 1:43 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, David S. Miller, Eric Dumazet,
Paolo Abeni, Breno Leitao
Cc: Chenguang Zhao, Simon Horman, Maxime Chevallier, netdev
ethnl_bitmap32_not_zero() should return true if some bit in [start, end)
is set:
- Fix inverted memchr_inv() sense: return true when the scan finds a
non-zero byte, not when the middle words are all zero.
- Return false for an empty interval (end <= start).
- When end is 32-bit aligned, indices in [start, end) do not include any
bits from map[end_word]; return false after earlier checks found no
non-zero data.
Fixes: 10b518d4e6dd ("ethtool: netlink bitset handling")
Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
---
v3:
- Adjust continuation line indentation as suggested by Kicinski.
---
net/ethtool/bitset.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/ethtool/bitset.c b/net/ethtool/bitset.c
index 8bb98d3ea3db..2198407d9b89 100644
--- a/net/ethtool/bitset.c
+++ b/net/ethtool/bitset.c
@@ -92,7 +92,7 @@ static bool ethnl_bitmap32_not_zero(const u32 *map, unsigned int start,
u32 mask;
if (end <= start)
- return true;
+ return false;
if (start % 32) {
mask = ethnl_upper_bits(start);
@@ -105,11 +105,11 @@ static bool ethnl_bitmap32_not_zero(const u32 *map, unsigned int start,
start_word++;
}
- if (!memchr_inv(map + start_word, '\0',
- (end_word - start_word) * sizeof(u32)))
+ if (memchr_inv(map + start_word, '\0',
+ (end_word - start_word) * sizeof(u32)))
return true;
if (end % 32 == 0)
- return true;
+ return false;
return map[end_word] & ethnl_lower_bits(end);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v3] ethtool: fix ethnl_bitmap32_not_zero() bit interval semantics
2026-05-11 1:43 [PATCH v3] ethtool: fix ethnl_bitmap32_not_zero() bit interval semantics Chenguang Zhao
@ 2026-05-13 3:45 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-05-13 3:45 UTC (permalink / raw)
To: Chenguang Zhao
Cc: andrew, kuba, davem, edumazet, pabeni, leitao, horms,
maxime.chevallier, netdev
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 11 May 2026 09:43:43 +0800 you wrote:
> ethnl_bitmap32_not_zero() should return true if some bit in [start, end)
> is set:
>
> - Fix inverted memchr_inv() sense: return true when the scan finds a
> non-zero byte, not when the middle words are all zero.
> - Return false for an empty interval (end <= start).
> - When end is 32-bit aligned, indices in [start, end) do not include any
> bits from map[end_word]; return false after earlier checks found no
> non-zero data.
>
> [...]
Here is the summary with links:
- [v3] ethtool: fix ethnl_bitmap32_not_zero() bit interval semantics
https://git.kernel.org/netdev/net/c/3d042592ebd4
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] 2+ messages in thread
end of thread, other threads:[~2026-05-13 3:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 1:43 [PATCH v3] ethtool: fix ethnl_bitmap32_not_zero() bit interval semantics Chenguang Zhao
2026-05-13 3:45 ` 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