[PATCH] net/ethtool: fix HWTSTAMP TX/FILTER BUILD_BUG_ON in tsconfig SET path

Chenguang Zhao posted 1 patch 4 weeks, 1 day ago
net/ethtool/tsconfig.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] net/ethtool: fix HWTSTAMP TX/FILTER BUILD_BUG_ON in tsconfig SET path
Posted by Chenguang Zhao 4 weeks, 1 day ago
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
Re: [PATCH] net/ethtool: fix HWTSTAMP TX/FILTER BUILD_BUG_ON in tsconfig SET path
Posted by Jakub Kicinski 4 weeks ago
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