From: Mauricio Faria de Oliveira <mfo@igalia.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-s390@vger.kernel.org,
Christian Borntraeger <borntraeger@linux.ibm.com>,
mptcp@lists.linux.dev, bpf@vger.kernel.org,
Alexander Gordeev <agordeev@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>
Subject: Re: [PATCH RFC v2 04/13] sysctl: add register_sysctl() wrapper for MODULE_SYSCTL_TABLE
Date: Wed, 19 Aug 2026 13:25:37 -0300 [thread overview]
Message-ID: <16f235f38612f57d670db10cd630bde0@igalia.com> (raw)
In-Reply-To: <20260819024437.87E5E1F000E9@smtp.kernel.org>
On 2026-08-18 23:44, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Medium] The macro `__UNIQUE_ID` is used without an argument in `__MODULE_SYSCTL_TABLE_NAME`, preventing its expansion.
Fixed.
> - [Low] Dangling trailing backslash on the last line of the `register_sysctl` macro definition.
Fixed.
> --
>
> --- Patch [4]: [PATCH RFC v2 04/13] sysctl: add register_sysctl() wrapper for MODULE_SYSCTL_TABLE ---
> commit 5518fc079c95785ae760d86da6be17693ac8aeea
> Author: Mauricio Faria de Oliveira <mfo@igalia.com>
>
> sysctl: add register_sysctl() wrapper for MODULE_SYSCTL_TABLE
>
> Add a MODULE_SYSCTL_TABLE call into register_sysctl() for existing callers
> to automatically use it.
>
>> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
>> index 6960fe22c50bf..7e05fafd5544e 100644
>> --- a/include/linux/sysctl.h
>> +++ b/include/linux/sysctl.h
>> @@ -335,8 +335,58 @@ struct ctl_table_root {
>> #define MODULE_SYSCTL_TABLE(path, table)
>> #endif
>
> [Severity: Medium]
> Does this code prevent __UNIQUE_ID from being expanded correctly?
>
> Looking at __MODULE_SYSCTL_TABLE_NAME in include/linux/sysctl.h:
>
> #define __MODULE_SYSCTL_TABLE_NAME(table) \
> __mod_device_table(sysctl, __UNIQUE_ID)
>
> Since __UNIQUE_ID is a function-like macro that requires an argument, using it
> without parentheses prevents preprocessor expansion. This results in the
> literal string being used to construct the symbol name, which defeats the
> purpose of generating a unique identifier and could cause symbol redefinition
> errors if MODULE_SYSCTL_TABLE is used multiple times.
>
>> -#define register_sysctl(path, table) \
>> - register_sysctl_sz(path, table, ARRAY_SIZE(table))
>> +/*
>> + * The register_sysctl() wrapper for the MODULE_SYSCTL_TABLE macro
>
> [ ... ]
>
>> +#define _register_sysctl(path, table, table_tmpl, path_tmpl) \
>> +({ \
>> + MODULE_SYSCTL_TABLE(path_tmpl, table_tmpl); \
>> + register_sysctl_sz(path, table, ARRAY_SIZE(table)); \
>> +})
>> +
>> +#define register_sysctl(path, table, tmpl_args...) \
>> + _register_sysctl(path, table, \
>> + __sysctl_table_tmpl_or_default(table, ## tmpl_args), \
>> + __sysctl_path_tmpl_or_default(path, ## tmpl_args)) \
>
> [Severity: Low]
> Is this trailing backslash intended?
>
> The trailing backslash on the last line of the register_sysctl macro
> definition will unnecessarily consume the empty line that follows it.
>
>> +
>> +/* Helper macros for optional template arguments */
--
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 [this message]
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
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=16f235f38612f57d670db10cd630bde0@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).