From: Mauricio Faria de Oliveira <mfo@igalia.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-s390@vger.kernel.org,
Alexander Gordeev <agordeev@linux.ibm.com>,
mptcp@lists.linux.dev, Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
bpf@vger.kernel.org,
Christian Borntraeger <borntraeger@linux.ibm.com>
Subject: Re: [PATCH RFC v2 06/13] sysctl, net: add register_net_sysctl{_sz}() wrappers for MODULE_SYSCTL_TABLE
Date: Wed, 19 Aug 2026 13:25:09 -0300 [thread overview]
Message-ID: <aec70e5fe7da3cbe1d3b61e1fcebda2a@igalia.com> (raw)
In-Reply-To: <20260819024054.DDB0E1F000E9@smtp.kernel.org>
On 2026-08-18 23:40, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] When `CONFIG_SYSCTL` is disabled, the build fails due to a preprocessor conflict where the newly introduced `register_net_sysctl_sz` macro expands inside its own fallback static inline function definition.
Fixed.
> --
>
> --- Patch [6]: [PATCH RFC v2 06/13] sysctl, net: add register_net_sysctl{_sz}() wrappers for MODULE_SYSCTL_TABLE ---
> commit fad97277609904f7e692d6e11a61fdff7e4ff635
> Author: Mauricio Faria de Oliveira <mfo@igalia.com>
>
> sysctl, net: add register_net_sysctl{_sz}() wrappers for MODULE_SYSCTL_TABLE
>
> This commit replaces register_net_sysctl() and register_net_sysctl_sz() with
> macros that automatically use MODULE_SYSCTL_TABLE for existing callers. It
> renames the actual sysctl registration function to __register_net_sysctl_sz()
> and adds optional template arguments to support dynamically defined paths and
> tables.
>
>> diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
>> index e5ee673b9fcf8..2127049c71ced 100644
>> --- a/include/net/net_namespace.h
>> +++ b/include/net/net_namespace.h
> [ ... ]
>> @@ -520,13 +520,48 @@ void unregister_pernet_device(struct pernet_operations *);
>>
>> struct ctl_table;
>>
>> -#define register_net_sysctl(net, path, table) \
>> - register_net_sysctl_sz(net, path, table, ARRAY_SIZE(table))
>> +/*
>> + * The register_net_sysctl{_sz}() wrappers for MODULE_SYSCTL_TABLE
>> + * automatically create symbols in sysctl registration sites.
> [ ... ]
>> + */
>> +#define _register_net_sysctl_sz(net, path, table, size, table_tmpl, path_tmpl) \
>> +({ \
>> + MODULE_SYSCTL_TABLE(path_tmpl, table_tmpl); \
>> + __register_net_sysctl_sz(net, path, table, size); \
>> +})
>> +
>> +#define register_net_sysctl_sz(net, path, table, size, tmpl_args...) \
>> + _register_net_sysctl_sz(net, path, table, size, \
>> + __sysctl_table_tmpl_or_default(table, \
>> + ## tmpl_args), \
>> + __sysctl_path_tmpl_or_default(path, \
>> + ## tmpl_args))
>> +#define register_net_sysctl(net, path, table, tmpl_args...) \
>> + register_net_sysctl_sz(net, path, table, \
>> + __sysctl_table_array_size(table, ## tmpl_args), \
>> + ## tmpl_args)
>> +
>> +/* Helper macro for optional template arguments */
>> +#define __sysctl_table_array_size(table, tmpl_args...) \
>> + ARRAY_SIZE(__sysctl_table_tmpl_or_default(table, ## tmpl_args))
>> +
>> #ifdef CONFIG_SYSCTL
>> int net_sysctl_init(void);
>> -struct ctl_table_header *register_net_sysctl_sz(struct net *net, const char *path,
>> - const struct ctl_table *table,
>> - size_t table_size);
>> +struct ctl_table_header *__register_net_sysctl_sz(struct net *net,
>> + const char *path,
>> + const struct ctl_table *table,
>> + size_t table_size);
>> void unregister_net_sysctl_table(struct ctl_table_header *header);
>> #else
>> static inline int net_sysctl_init(void) { return 0; }
>
> [Severity: Low]
> Does this commit break the build when CONFIG_SYSCTL is disabled?
>
> Because register_net_sysctl_sz() is now defined as a macro unconditionally
> above, the fallback static inline function in this #else block:
>
> static inline struct ctl_table_header *register_net_sysctl_sz(struct net *net,
> const char *path, const struct ctl_table *table, size_t table_size)
> {
> return NULL;
> }
>
> will cause a macro expansion conflict.
>
> Should this static inline function be renamed to __register_net_sysctl_sz()
> to avoid expanding the macro in its own definition and to provide the fallback
> implementation needed by the new macro?
--
Mauricio
next prev parent reply other threads:[~2026-08-19 16:25 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 2:27 [PATCH RFC v2 00/13] sysctl: add module aliases Mauricio Faria de Oliveira
2026-08-19 2:28 ` [PATCH RFC v2 01/13] keys, pidns, fs/verity, riscv/vector: reorder '#include <linux/sysctl.h>' Mauricio Faria de Oliveira
2026-08-19 2:33 ` sashiko-bot
2026-08-19 2:28 ` [PATCH RFC v2 02/13] proc: add config option SYSCTL_MODULE_ALIASES Mauricio Faria de Oliveira
2026-08-19 2:37 ` sashiko-bot
2026-08-19 16:24 ` Mauricio Faria de Oliveira
2026-08-19 2:28 ` [PATCH RFC v2 03/13] sysctl, mod_devicetable: add macro MODULE_SYSCTL_TABLE Mauricio Faria de Oliveira
2026-08-19 2:40 ` sashiko-bot
2026-08-19 16:26 ` Mauricio Faria de Oliveira
2026-08-19 2:28 ` [PATCH RFC v2 04/13] sysctl: add register_sysctl() wrapper for MODULE_SYSCTL_TABLE Mauricio Faria de Oliveira
2026-08-19 2:44 ` sashiko-bot
2026-08-19 16:25 ` Mauricio Faria de Oliveira
2026-08-19 2:28 ` [PATCH RFC v2 05/13] sysctl, parport: update register_sysctl() callers with template arguments Mauricio Faria de Oliveira
2026-08-19 2:44 ` sashiko-bot
2026-08-19 16:25 ` Mauricio Faria de Oliveira
2026-08-19 2:28 ` [PATCH RFC v2 06/13] sysctl, net: add register_net_sysctl{_sz}() wrappers for MODULE_SYSCTL_TABLE Mauricio Faria de Oliveira
2026-08-19 2:40 ` sashiko-bot
2026-08-19 16:25 ` Mauricio Faria de Oliveira [this message]
2026-08-19 2:28 ` [PATCH RFC v2 07/13] sysctl, net: update register_net_sysctl{_sz}() callers with template arguments Mauricio Faria de Oliveira
2026-08-19 2:48 ` sashiko-bot
2026-08-19 16:25 ` Mauricio Faria de Oliveira
2026-08-19 2:28 ` [PATCH RFC v2 08/13] sysctl, net: update register_net_sysctl_sz(ARRAY_SIZE(table_tmpl)) " Mauricio Faria de Oliveira
2026-08-19 2:36 ` sashiko-bot
2026-08-19 2:28 ` [PATCH RFC v2 09/13] sysctl, ipv6: update register_net_sysctl{_sz}() callers " Mauricio Faria de Oliveira
2026-08-19 2:36 ` sashiko-bot
2026-08-19 2:28 ` [PATCH RFC v2 10/13] sysctl, net: update register_net_sysctl_sz() edge case Mauricio Faria de Oliveira
2026-08-19 2:39 ` sashiko-bot
2026-08-19 2:28 ` [PATCH RFC v2 11/13] sysctl: unrandomize struct ctl_table.procname Mauricio Faria de Oliveira
2026-08-19 2:38 ` sashiko-bot
2026-08-19 2:28 ` [PATCH RFC v2 12/13] modpost: move addend_*_rel() calls into addend_rel() Mauricio Faria de Oliveira
2026-08-19 2:39 ` sashiko-bot
2026-08-19 2:28 ` [PATCH RFC v2 13/13] modpost: handle MODULE_SYSCTL_TABLE symbols Mauricio Faria de Oliveira
2026-08-19 2:48 ` sashiko-bot
2026-08-19 16:29 ` Mauricio Faria de Oliveira
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aec70e5fe7da3cbe1d3b61e1fcebda2a@igalia.com \
--to=mfo@igalia.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=bpf@vger.kernel.org \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).