* [PATCH] init: fix the wrong __setup_param() definition
@ 2021-12-20 3:54 Yajun Deng
2021-12-20 11:20 ` Marco Elver
0 siblings, 1 reply; 3+ messages in thread
From: Yajun Deng @ 2021-12-20 3:54 UTC (permalink / raw)
To: keescook, samitolvanen, ojeda, masahiroy, elver; +Cc: linux-kernel, Yajun Deng
The parameters in __setup_param() should be four rather than three when
MODULE isn't definited.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
include/linux/init.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/init.h b/include/linux/init.h
index d82b4b2e1d25..62a77850f10e 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -355,7 +355,7 @@ void __init parse_early_options(char *cmdline);
#else /* MODULE */
-#define __setup_param(str, unique_id, fn) /* nothing */
+#define __setup_param(str, unique_id, fn, early)/* nothing */
#define __setup(str, func) /* nothing */
#endif
--
2.32.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] init: fix the wrong __setup_param() definition 2021-12-20 3:54 [PATCH] init: fix the wrong __setup_param() definition Yajun Deng @ 2021-12-20 11:20 ` Marco Elver 2021-12-21 2:08 ` yajun.deng 0 siblings, 1 reply; 3+ messages in thread From: Marco Elver @ 2021-12-20 11:20 UTC (permalink / raw) To: Yajun Deng; +Cc: keescook, samitolvanen, ojeda, masahiroy, linux-kernel On Mon, 20 Dec 2021 at 04:55, Yajun Deng <yajun.deng@linux.dev> wrote: > > The parameters in __setup_param() should be four rather than three when > MODULE isn't definited. This is actually "when MODULE is defined". __setup_param() becomes a nop when compiling as a module. But that begs the question: why hasn't this been caught before? Probably because nobody should be using __setup_param() if something can also be compiled as a module, in which case module_param() and friends should be used. But perhaps there are valid usecases where i t's meant to become a nop if MODULE. I don't object this fix, since the !MODULE __setup_param() seems like it was meant to be defined. Just curious: did you actually encounter a problem with some new code using __setup_param()? > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Signed-off-by: Yajun Deng <yajun.deng@linux.dev> > --- > include/linux/init.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/init.h b/include/linux/init.h > index d82b4b2e1d25..62a77850f10e 100644 > --- a/include/linux/init.h > +++ b/include/linux/init.h > @@ -355,7 +355,7 @@ void __init parse_early_options(char *cmdline); > > #else /* MODULE */ > > -#define __setup_param(str, unique_id, fn) /* nothing */ > +#define __setup_param(str, unique_id, fn, early)/* nothing */ > #define __setup(str, func) /* nothing */ > #endif > > -- > 2.32.0 > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] init: fix the wrong __setup_param() definition 2021-12-20 11:20 ` Marco Elver @ 2021-12-21 2:08 ` yajun.deng 0 siblings, 0 replies; 3+ messages in thread From: yajun.deng @ 2021-12-21 2:08 UTC (permalink / raw) To: Marco Elver; +Cc: keescook, samitolvanen, ojeda, masahiroy, linux-kernel December 20, 2021 7:20 PM, "Marco Elver" <elver@google.com> wrote: > On Mon, 20 Dec 2021 at 04:55, Yajun Deng <yajun.deng@linux.dev> wrote: > >> The parameters in __setup_param() should be four rather than three when >> MODULE isn't definited. > > This is actually "when MODULE is defined". __setup_param() becomes a > nop when compiling as a module. > > But that begs the question: why hasn't this been caught before? > Probably because nobody should be using __setup_param() if something > can also be compiled as a module, in which case module_param() and > friends should be used. But perhaps there are valid usecases where i > t's meant to become a nop if MODULE. > > I don't object this fix, since the !MODULE __setup_param() seems like > it was meant to be defined. > > Just curious: did you actually encounter a problem with some new code > using __setup_param()? NO, it is just code inspection. But for the current code, it's really a bug. vim drivers/clk/imx/clk.c +161 #ifndef MODULE ... __setup_param("earlycon", imx_keep_uart_earlycon, imx_keep_uart_clocks_param, 0); __setup_param("earlyprintk", imx_keep_uart_earlyprintk, imx_keep_uart_clocks_param, 0); > >> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") >> Signed-off-by: Yajun Deng <yajun.deng@linux.dev> >> --- >> include/linux/init.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/include/linux/init.h b/include/linux/init.h >> index d82b4b2e1d25..62a77850f10e 100644 >> --- a/include/linux/init.h >> +++ b/include/linux/init.h >> @@ -355,7 +355,7 @@ void __init parse_early_options(char *cmdline); >> >> #else /* MODULE */ >> >> -#define __setup_param(str, unique_id, fn) /* nothing */ >> +#define __setup_param(str, unique_id, fn, early)/* nothing */ >> #define __setup(str, func) /* nothing */ >> #endif >> >> -- >> 2.32.0 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-21 2:08 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-12-20 3:54 [PATCH] init: fix the wrong __setup_param() definition Yajun Deng 2021-12-20 11:20 ` Marco Elver 2021-12-21 2:08 ` yajun.deng
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox