Skip to contentSkip to conversation

modpost: turn static exports into error

PATCH In review Quentin Perret 2 participants 2 messages Dec 1, 2020 – Dec 16, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 modpost: turn static exports into error

Using EXPORT_SYMBOL*() on static functions is fundamentally wrong. Modpost currently reports that as a warning, but clearly this is not a pattern we should allow, and all in-tree occurences should have been fixed by now. So, promote the warn() message to error() to make sure this never happens again.

---
v2: now depends on [email protected]

---
 scripts/mod/modpost.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/mod/modpost.c +3 -3
index 43e00867623a..5562526c8c32 100644
@@ -2648,9 +2648,9 @@ int main(int argc, char **argv)
 
 		for (s = symbolhash[n]; s; s = s->next) {
 			if (s->is_static)
-				warn("\"%s\" [%s] is a static %s\n",
-				     s->name, s->module->name,
-				     export_str(s->export));
+				error("\"%s\" [%s] is a static %s\n",
+				      s->name, s->module->name,
+				      export_str(s->export));
 		}
 	}
 
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
#1 lore raw
Quoted 7 lines · Quentin Perret

Using EXPORT_SYMBOL*() on static functions is fundamentally wrong. Modpost currently reports that as a warning, but clearly this is not a pattern we should allow, and all in-tree occurences should have been fixed by now. So, promote the warn() message to error() to make sure this never happens again.

Quoted 6 lines

---
v2: now depends on [email protected]

Applied to linux-kbuild. Thanks.

Quoted 24 lines
---
 scripts/mod/modpost.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/mod/modpost.c +3 -4
index 43e00867623a..5562526c8c32 100644
@@ -2648,9 +2648,9 @@ int main(int argc, char **argv)
 
                for (s = symbolhash[n]; s; s = s->next) {
                        if (s->is_static)
-                               warn("\"%s\" [%s] is a static %s\n",
-                                    s->name, s->module->name,
-                                    export_str(s->export));
+                               error("\"%s\" [%s] is a static %s\n",
+                                     s->name, s->module->name,
+                                     export_str(s->export));
                }
        }
 
--

2.29.2.454.gaff20da3a2-goog

Signature · 2 lines
Best Regards
Masahiro Yamada