The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] net/ethtool: fix HWTSTAMP TX/FILTER BUILD_BUG_ON in tsconfig SET path
@ 2026-05-14  9:15 Chenguang Zhao
  2026-05-14 13:57 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Chenguang Zhao @ 2026-05-14  9:15 UTC (permalink / raw)
  To: Andrew Lunn, Jakub Kicinski, David S. Miller, Eric Dumazet,
	Paolo Abeni, Simon Horman
  Cc: Chenguang Zhao, netdev, linux-kernel

BUILD_BUG_ON(__HWTSTAMP_TX_CNT >= 32) and the same for
__HWTSTAMP_FILTER_CNT reject the valid upper bound of
32 enum-derived bit positions in a u32 bitset (indices 0 .. 31).
Use > 32 so only counts strictly larger than the u32
width fail at compile time.

Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
---
 net/ethtool/tsconfig.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ethtool/tsconfig.c b/net/ethtool/tsconfig.c
index e4f518e49d4c..bdf26352de2d 100644
--- a/net/ethtool/tsconfig.c
+++ b/net/ethtool/tsconfig.c
@@ -302,8 +302,8 @@ static int ethnl_set_tsconfig(struct ethnl_req_info *req_base,
 	struct nlattr **tb = info->attrs;
 	int ret;
 
-	BUILD_BUG_ON(__HWTSTAMP_TX_CNT >= 32);
-	BUILD_BUG_ON(__HWTSTAMP_FILTER_CNT >= 32);
+	BUILD_BUG_ON(__HWTSTAMP_TX_CNT > 32);
+	BUILD_BUG_ON(__HWTSTAMP_FILTER_CNT > 32);
 	BUILD_BUG_ON(__HWTSTAMP_FLAG_CNT > 32);
 
 	if (!netif_device_present(dev))
-- 
2.25.1


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

* Re: [PATCH] net/ethtool: fix HWTSTAMP TX/FILTER BUILD_BUG_ON in tsconfig SET path
  2026-05-14  9:15 [PATCH] net/ethtool: fix HWTSTAMP TX/FILTER BUILD_BUG_ON in tsconfig SET path Chenguang Zhao
@ 2026-05-14 13:57 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2026-05-14 13:57 UTC (permalink / raw)
  To: Chenguang Zhao
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
	Simon Horman, netdev, linux-kernel

On Thu, 14 May 2026 17:15:37 +0800 Chenguang Zhao wrote:
> BUILD_BUG_ON(__HWTSTAMP_TX_CNT >= 32) and the same for
> __HWTSTAMP_FILTER_CNT reject the valid upper bound of
> 32 enum-derived bit positions in a u32 bitset (indices 0 .. 31).
> Use > 32 so only counts strictly larger than the u32
> width fail at compile time.

If someone needs to use 32 they can investigate this properly and bump
the bound. Either you're not explaining the problem well or this is
a complete noop right now
-- 
pw-bot: reject

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

end of thread, other threads:[~2026-05-14 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14  9:15 [PATCH] net/ethtool: fix HWTSTAMP TX/FILTER BUILD_BUG_ON in tsconfig SET path Chenguang Zhao
2026-05-14 13:57 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox