Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The `_register_sysctl` wrapper incorrectly uses `ARRAY_SIZE(table)` instead of `ARRAY_SIZE(table_tmpl)`, breaking the newly introduced template arguments feature for dynamic pointer tables.
- [Low] Fragile symbol name generation in `__MODULE_SYSCTL_TABLE_NAME` causes token-pasting syntax errors for complex arguments.
--
--- Patch [4]: [PATCH RFC v3 04/13] sysctl: add register_sysctl() wrapper for MODULE_SYSCTL_TABLE ---
commit c193948aeca054c46d40a2f5711a72369114c454
Author: Mauricio Faria de Oliveira <[email protected]>
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/drivers/parport/procfs.c b/drivers/parport/procfs.c
> index 3880460e67f25..cda3221e386ed 100644
> --- a/drivers/parport/procfs.c
> +++ b/drivers/parport/procfs.c
> @@ -13,6 +13,8 @@
> * Cleaned up include files - Russell King <[email protected]>
> */
>
> +#define SYSCTL_MODULE_ALIASES_DISABLE
> +
[Severity: Low]
Does the need for this disable flag suggest fragile symbol name generation
in __MODULE_SYSCTL_TABLE_NAME?
When register_sysctl() is called with a struct field or pointer dereference
(e.g., dev->table), the generated macro attempts to create a C identifier
containing -> or ., resulting in a compiler syntax error.
Would unconditionally using __UNIQUE_ID(sysctl) prevent this fragility
without requiring callers to use escape hatches like this?
[ ... ]
> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> index 0adc056ff54d8..b808fbc1d964f 100644
> --- a/include/linux/sysctl.h
> +++ b/include/linux/sysctl.h
[ ... ]
> +#define _register_sysctl(path, table, table_tmpl, path_tmpl) \
> +({ \
> + MODULE_SYSCTL_TABLE(path_tmpl, table_tmpl); \
> + register_sysctl_sz(path, table, ARRAY_SIZE(table)); \
[Severity: Medium]
Will this break the template arguments feature for dynamic pointer tables?
If a caller attempts to use the template arguments feature with a dynamically
allocated pointer table, ARRAY_SIZE(table) will cause a compilation failure
because ARRAY_SIZE() cannot be applied to a pointer.
Since MODULE_SYSCTL_TABLE() explicitly enforces that the build-time template
is an array, should this macro use ARRAY_SIZE(table_tmpl) instead? This
would resolve the size correctly and allow the runtime table to be a
dynamically allocated pointer.
> +})
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.