Skip to contentSkip to conversation

script: modpost: emit a warning when the description is missing

PATCH Superseded Vincenzo Palazzo 2 participants 5 messages Mar 9, 2023 – Jun 15, 2023 Kbuild

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 script: modpost: emit a warning when the description is missing

Emit a warning when the mod description is missed and only when the W=1 is enabled.

---
 scripts/mod/modpost.c | 4 ++++
 1 file changed, 4 insertions(+)
scripts/mod/modpost.c +4 -0
index efff8078e395..433518dfc472 100644
@@ -1824,6 +1824,10 @@ static void read_symbols(const char *modname)
 		}
 	}
 
+#ifdef WARN
+	if (!get_modinfo(&info, "description"))
+		warn("missing MODULE_DESCRIPTION() in %s\n", modname);
+#endif
 	for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
 		symname = remove_dot(info.strtab + sym->st_name);
 
Signature · 1 line
2.39.2
#1 lore raw
Quoted 16 lines · Vincenzo Palazzo

Emit a warning when the mod description is missed and only when the W=1 is enabled.

---
 scripts/mod/modpost.c | 4 ++++
 1 file changed, 4 insertions(+)
scripts/mod/modpost.c +0 -0
index efff8078e395..433518dfc472 100644

scripts/mod/modpost.c static void read_symbols(const char *modname) · line 1832

Quoted 9 lines
scripts/mod/modpost.c +4 -0
@@ -1824,6 +1824,10 @@ static void read_symbols(const char *modname)
                }
        }
 
+#ifdef WARN
+       if (!get_modinfo(&info, "description"))
+               warn("missing MODULE_DESCRIPTION() in %s\n", modname);
+#endif
        for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
                symname = remove_dot(info.strtab + sym->st_name);

Sorry for the delay.

Users need to do "make HOSTCFLAGS=-DWARN" to make it work, but nobody would do it.

I did a ground work:
https://patchwork.kernel.org/project/linux-kbuild/patch/[email protected]/

Then, you can do like this:

  if (extra_warn && !get_modinfo(&info, "description"))
           warn("missing MODULE_DESCRIPTION() in %s\n", modname);
Quoted 3 lines
scripts/mod/modpost.c +0 -1
--

2.39.2

Signature · 2 lines
Best Regards
Masahiro Yamada
#2 lore raw
Quoted 31 lines
Quoted 16 lines · Vincenzo Palazzo

Emit a warning when the mod description is missed and only when the W=1 is enabled.

---
 scripts/mod/modpost.c | 4 ++++
 1 file changed, 4 insertions(+)
scripts/mod/modpost.c +0 -0
index efff8078e395..433518dfc472 100644

scripts/mod/modpost.c static void read_symbols(const char *modname) · line 1832

Quoted 9 lines
scripts/mod/modpost.c +4 -0
@@ -1824,6 +1824,10 @@ static void read_symbols(const char *modname)
                }
        }
 
+#ifdef WARN
+       if (!get_modinfo(&info, "description"))
+               warn("missing MODULE_DESCRIPTION() in %s\n", modname);
+#endif
        for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
                symname = remove_dot(info.strtab + sym->st_name);

Sorry for the delay.

Quoted 7 lines

Users need to do "make HOSTCFLAGS=-DWARN" to make it work, but nobody would do it.

I did a ground work:
https://patchwork.kernel.org/project/linux-kbuild/patch/[email protected]/

Uh, thanks for doing this!

Quoted 7 lines

Then, you can do like this:

  if (extra_warn && !get_modinfo(&info, "description"))
           warn("missing MODULE_DESCRIPTION() in %s\n", modname);

Do you preferer that I rebase on top of your patch? or just waiting that your patch will be in next?

#3 lore raw
Quoted 44 lines · Vincenzo Palazzo
Quoted 32 lines
Quoted 16 lines · Vincenzo Palazzo

Emit a warning when the mod description is missed and only when the W=1 is enabled.

---
 scripts/mod/modpost.c | 4 ++++
 1 file changed, 4 insertions(+)
scripts/mod/modpost.c +0 -0
index efff8078e395..433518dfc472 100644

scripts/mod/modpost.c static void read_symbols(const char *modname) · line 1832

Quoted 9 lines
scripts/mod/modpost.c +4 -0
@@ -1824,6 +1824,10 @@ static void read_symbols(const char *modname)
                }
        }
 
+#ifdef WARN
+       if (!get_modinfo(&info, "description"))
+               warn("missing MODULE_DESCRIPTION() in %s\n", modname);
+#endif
        for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
                symname = remove_dot(info.strtab + sym->st_name);

Sorry for the delay.

Quoted 7 lines

Users need to do "make HOSTCFLAGS=-DWARN" to make it work, but nobody would do it.

I did a ground work:
https://patchwork.kernel.org/project/linux-kbuild/patch/[email protected]/

Uh, thanks for doing this!

Quoted 2 lines
Quoted 8 lines
Quoted 5 lines

Then, you can do like this:

  if (extra_warn && !get_modinfo(&info, "description"))
           warn("missing MODULE_DESCRIPTION() in %s\n", modname);

Do you preferer that I rebase on top of your patch? or just waiting that your patch will be in next?

Whichever. Your patch changes a different hunk,
so no merge conflict would happen anyway.

Signature · 2 lines
Best Regards
Masahiro Yamada
#4 lore raw
In reply to Masahiro Yamada
Quoted 31 lines
Quoted 16 lines · Vincenzo Palazzo

Emit a warning when the mod description is missed and only when the W=1 is enabled.

---
 scripts/mod/modpost.c | 4 ++++
 1 file changed, 4 insertions(+)
scripts/mod/modpost.c +0 -0
index efff8078e395..433518dfc472 100644

scripts/mod/modpost.c static void read_symbols(const char *modname) · line 1832

Quoted 9 lines
scripts/mod/modpost.c +4 -0
@@ -1824,6 +1824,10 @@ static void read_symbols(const char *modname)
                }
        }
 
+#ifdef WARN
+       if (!get_modinfo(&info, "description"))
+               warn("missing MODULE_DESCRIPTION() in %s\n", modname);
+#endif
        for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
                symname = remove_dot(info.strtab + sym->st_name);

Sorry for the delay.

Quoted 2 lines

Users need to do "make HOSTCFLAGS=-DWARN" to make it work, but nobody would do it.

Ok coming on this with some more time while my machine is building, my code should work with the make W=1 (but the kernel do not work with the warnings enables)

I do not know if you was meaning another thing.

Quoted 10 lines

I did a ground work:
https://patchwork.kernel.org/project/linux-kbuild/patch/[email protected]/

Then, you can do like this:

  if (extra_warn && !get_modinfo(&info, "description"))
           warn("missing MODULE_DESCRIPTION() in %s\n", modname);

Preparing the version 3.

Vincent.