[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230731071728.3493794-14-j.granados@samsung.com>
Date: Mon, 31 Jul 2023 09:17:27 +0200
From: Joel Granados <joel.granados@...il.com>
To: mcgrof@...nel.org
Cc: Catalin Marinas <catalin.marinas@....com>,
Iurii Zaikin <yzaikin@...gle.com>,
Jozsef Kadlecsik <kadlec@...filter.org>,
Sven Schnelle <svens@...ux.ibm.com>,
Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
Steffen Klassert <steffen.klassert@...unet.com>,
Kees Cook <keescook@...omium.org>,
"D. Wythe" <alibuda@...ux.alibaba.com>, mptcp@...ts.linux.dev,
Jakub Kicinski <kuba@...nel.org>,
Vasily Gorbik <gor@...ux.ibm.com>,
Paolo Abeni <pabeni@...hat.com>, coreteam@...filter.org,
Jan Karcher <jaka@...ux.ibm.com>,
Alexander Aring <alex.aring@...il.com>,
Will Deacon <will@...nel.org>,
Stefan Schmidt <stefan@...enfreihafen.org>,
Matthieu Baerts <matthieu.baerts@...sares.net>,
bridge@...ts.linux-foundation.org,
linux-arm-kernel@...ts.infradead.org,
Joerg Reuter <jreuter@...na.de>, Julian Anastasov <ja@....bg>,
David Ahern <dsahern@...nel.org>,
netfilter-devel@...r.kernel.org, Wen Gu <guwen@...ux.alibaba.com>,
linux-kernel@...r.kernel.org,
Santosh Shilimkar <santosh.shilimkar@...cle.com>,
linux-wpan@...r.kernel.org, lvs-devel@...r.kernel.org,
Karsten Graul <kgraul@...ux.ibm.com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
linux-sctp@...r.kernel.org, Tony Lu <tonylu@...ux.alibaba.com>,
Pablo Neira Ayuso <pablo@...filter.org>,
Ralf Baechle <ralf@...ux-mips.org>,
Florian Westphal <fw@...len.de>, willy@...radead.org,
Heiko Carstens <hca@...ux.ibm.com>,
"David S. Miller" <davem@...emloft.net>,
linux-rdma@...r.kernel.org, Roopa Prabhu <roopa@...dia.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Simon Horman <horms@...ge.net.au>,
Mat Martineau <martineau@...nel.org>, josh@...htriplett.org,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Eric Dumazet <edumazet@...gle.com>, linux-hams@...r.kernel.org,
Wenjia Zhang <wenjia@...ux.ibm.com>,
linux-fsdevel@...r.kernel.org, linux-s390@...r.kernel.org,
Xin Long <lucien.xin@...il.com>,
Nikolay Aleksandrov <razor@...ckwall.org>,
netdev@...r.kernel.org, rds-devel@....oracle.com,
Joel Granados <j.granados@...sung.com>,
Jani Nikula <jani.nikula@...ux.intel.com>
Subject: [PATCH v2 13/14] sysctl: SIZE_MAX->ARRAY_SIZE in register_net_sysctl
Replace SIZE_MAX with ARRAY_SIZE in the register_net_sysctl macro. Now
that all the callers to register_net_sysctl are actual arrays, we can
call ARRAY_SIZE() without any compilation warnings. By calculating the
actual array size, this commit is making sure that register_net_sysctl
and all its callers forward the table_size into sysctl backend for when
the sentinel elements in the ctl_table arrays (last empty markers) are
removed. Without it the removal would fail lacking a stopping criteria
for traversing the ctl_table arrays.
Stopping condition continues to be based on both table size and the
procname null test. This is needed in order to allow for the systematic
removal al the sentinel element in subsequent commits: Before removing
sentinel the stopping criteria will be the last null element. When the
sentinel is removed then the (correct) size will take over.
Signed-off-by: Joel Granados <j.granados@...sung.com>
Suggested-by: Jani Nikula <jani.nikula@...ux.intel.com>
---
include/net/net_namespace.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index e4e5fe75a281..75dba309e043 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -470,7 +470,7 @@ void unregister_pernet_device(struct pernet_operations *);
struct ctl_table;
#define register_net_sysctl(net, path, table) \
- register_net_sysctl_sz(net, path, table, SIZE_MAX)
+ register_net_sysctl_sz(net, path, table, ARRAY_SIZE(table))
#ifdef CONFIG_SYSCTL
int net_sysctl_init(void);
struct ctl_table_header *register_net_sysctl_sz(struct net *net, const char *path,
--
2.30.2
Powered by blists - more mailing lists