Message ID | 20241218234137.1687288-2-pablo@netfilter.org (mailing list archive) |
---|---|
State | Accepted |
Commit | cf2c97423a4f89c8b798294d3f34ecfe7e7035c3 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net,1/2] ipvs: Fix clamp() of ip_vs_conn_tab on small memory systems | expand |
Hello: This series was applied to netdev/net.git (main) by Pablo Neira Ayuso <pablo@netfilter.org>: On Thu, 19 Dec 2024 00:41:36 +0100 you wrote: > From: David Laight <David.Laight@ACULAB.COM> > > The 'max_avail' value is calculated from the system memory > size using order_base_2(). > order_base_2(x) is defined as '(x) ? fn(x) : 0'. > The compiler generates two copies of the code that follows > and then expands clamp(max, min, PAGE_SHIFT - 12) (11 on 32bit). > This triggers a compile-time assert since min is 5. > > [...] Here is the summary with links: - [net,1/2] ipvs: Fix clamp() of ip_vs_conn_tab on small memory systems https://git.kernel.org/netdev/net/c/cf2c97423a4f - [net,2/2] netfilter: ipset: Fix for recursive locking warning https://git.kernel.org/netdev/net/c/70b6f46a4ed8 You are awesome, thank you!
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c index 98d7dbe3d787..c0289f83f96d 100644 --- a/net/netfilter/ipvs/ip_vs_conn.c +++ b/net/netfilter/ipvs/ip_vs_conn.c @@ -1495,8 +1495,8 @@ int __init ip_vs_conn_init(void) max_avail -= 2; /* ~4 in hash row */ max_avail -= 1; /* IPVS up to 1/2 of mem */ max_avail -= order_base_2(sizeof(struct ip_vs_conn)); - max = clamp(max, min, max_avail); - ip_vs_conn_tab_bits = clamp_val(ip_vs_conn_tab_bits, min, max); + max = clamp(max_avail, min, max); + ip_vs_conn_tab_bits = clamp(ip_vs_conn_tab_bits, min, max); ip_vs_conn_tab_size = 1 << ip_vs_conn_tab_bits; ip_vs_conn_tab_mask = ip_vs_conn_tab_size - 1;