Re: [PATCH v4 1/3] module: pull out add_taint_module() to be public
From: sashiko-bot@kernel.org
Date: 2026-09-14 14:38:07
Also in:
linux-trace-kernel
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Missing EXPORT_SYMBOL for add_taint_module() causes link failures for loadable modules. -- commit af64416dcd45d326037820ed7ffd035efeed6ec0 Author: Greg Kroah-Hartman [off-list ref] module: pull out add_taint_module() to be public This commit extracts add_taint_module() and makes it a globally accessible function so that other kernel code can call it to taint specific modules.
quoted hunk ↗ jump to hunk
diff --git a/kernel/module/main.c b/kernel/module/main.c index d0e1e0bd2ad06..444d990c99832 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -191,11 +191,21 @@ static inline int strong_try_module_get(struct module *mod) return -ENOENT; } -static inline void add_taint_module(struct module *mod, unsigned flag, - enum lockdep_ok lockdep_ok) +/** + * add_taint_module: add a taint flag if not already set for a specific module + * @mod: pointer to the module that caused the problem + * @flag: one of the TAINT_* constants. + * @lockdep_ok: whether lock debugging is still OK. + * + * If something bad has gone wrong, you'll want @lockdebug_ok = false, but for + * some noteworthy-but-not-corrupting cases, it can be set to true. + */ +void add_taint_module(struct module *mod, unsigned flag, + enum lockdep_ok lockdep_ok) { add_taint(flag, lockdep_ok); - set_bit(flag, &mod->taints); + if (mod) + set_bit(flag, &mod->taints); }
[Severity: Low] Since the commit message mentions that other kernel code might want to call add_taint_module(), does this function need an EXPORT_SYMBOL() declaration? Without an export, if a loadable module attempts to use this function as a module-aware counterpart to add_taint(), it will cause a build error due to an undefined reference during the modpost stage. -- Sashiko AI review · https://sashiko.dev/#/patchset/20260914-bind_taint-v4-0-eadf8a090903@linuxfoundation.org?part=1