lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230809105006.1198165-14-j.granados@samsung.com>
Date:   Wed,  9 Aug 2023 12:50:05 +0200
From:   Joel Granados <joel.granados@...il.com>
To:     mcgrof@...nel.org
Cc:     rds-devel@....oracle.com, "David S. Miller" <davem@...emloft.net>,
        Florian Westphal <fw@...len.de>, willy@...radead.org,
        Jan Karcher <jaka@...ux.ibm.com>,
        Wen Gu <guwen@...ux.alibaba.com>,
        Simon Horman <horms@...ge.net.au>,
        Tony Lu <tonylu@...ux.alibaba.com>, linux-wpan@...r.kernel.org,
        Matthieu Baerts <matthieu.baerts@...sares.net>,
        Christian Borntraeger <borntraeger@...ux.ibm.com>,
        mptcp@...ts.linux.dev, Heiko Carstens <hca@...ux.ibm.com>,
        Stefan Schmidt <stefan@...enfreihafen.org>,
        Will Deacon <will@...nel.org>, Julian Anastasov <ja@....bg>,
        netfilter-devel@...r.kernel.org, Joerg Reuter <jreuter@...na.de>,
        linux-kernel@...r.kernel.org,
        Alexander Gordeev <agordeev@...ux.ibm.com>,
        linux-sctp@...r.kernel.org, Xin Long <lucien.xin@...il.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        linux-hams@...r.kernel.org, Vasily Gorbik <gor@...ux.ibm.com>,
        coreteam@...filter.org, Ralf Baechle <ralf@...ux-mips.org>,
        Steffen Klassert <steffen.klassert@...unet.com>,
        Pablo Neira Ayuso <pablo@...filter.org>,
        keescook@...omium.org, Roopa Prabhu <roopa@...dia.com>,
        David Ahern <dsahern@...nel.org>,
        linux-arm-kernel@...ts.infradead.org,
        Catalin Marinas <catalin.marinas@....com>,
        Jozsef Kadlecsik <kadlec@...filter.org>,
        Wenjia Zhang <wenjia@...ux.ibm.com>, josh@...htriplett.org,
        linux-fsdevel@...r.kernel.org,
        Alexander Aring <alex.aring@...il.com>,
        Nikolay Aleksandrov <razor@...ckwall.org>,
        netdev@...r.kernel.org,
        Santosh Shilimkar <santosh.shilimkar@...cle.com>,
        linux-s390@...r.kernel.org, Sven Schnelle <svens@...ux.ibm.com>,
        "D. Wythe" <alibuda@...ux.alibaba.com>,
        Eric Dumazet <edumazet@...gle.com>, lvs-devel@...r.kernel.org,
        linux-rdma@...r.kernel.org, Paolo Abeni <pabeni@...hat.com>,
        Iurii Zaikin <yzaikin@...gle.com>,
        Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
        bridge@...ts.linux-foundation.org,
        Karsten Graul <kgraul@...ux.ibm.com>,
        Mat Martineau <martineau@...nel.org>,
        Miquel Raynal <miquel.raynal@...tlin.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Joel Granados <j.granados@...sung.com>,
        Jani Nikula <jani.nikula@...ux.intel.com>
Subject: [PATCH v3 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

Powered by Openwall GNU/*/Linux Powered by OpenVZ