diff mbox series

[v2] script: modpost: emit a warning when the description is missing

Message ID 20230309120103.61108-1-vincenzopalazzodev@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v2] script: modpost: emit a warning when the description is missing | expand

Commit Message

Vincenzo Palazzo March 9, 2023, 12:01 p.m. UTC
Emit a warning when the mod description is missed and only
when the W=1 is enabled.

Reported-by: Roland Kletzing <devzero@web.de>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=10770
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
---
 scripts/mod/modpost.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Masahiro Yamada June 6, 2023, 10:58 a.m. UTC | #1
On Thu, Mar 9, 2023 at 9:01 PM Vincenzo Palazzo
<vincenzopalazzodev@gmail.com> wrote:
>
> Emit a warning when the mod description is missed and only
> when the W=1 is enabled.
>
> Reported-by: Roland Kletzing <devzero@web.de>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=10770
> Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
> ---
>  scripts/mod/modpost.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index efff8078e395..433518dfc472 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -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/20230606094159.1910369-1-masahiroy@kernel.org/



Then, you can do like this:

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




> --
> 2.39.2
>
Vincenzo Palazzo June 7, 2023, 8:06 p.m. UTC | #2
> On Thu, Mar 9, 2023 at 9:01 PM Vincenzo Palazzo
> <vincenzopalazzodev@gmail.com> wrote:
> >
> > Emit a warning when the mod description is missed and only
> > when the W=1 is enabled.
> >
> > Reported-by: Roland Kletzing <devzero@web.de>
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=10770
> > Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
> > ---
> >  scripts/mod/modpost.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> > index efff8078e395..433518dfc472 100644
> > --- a/scripts/mod/modpost.c
> > +++ b/scripts/mod/modpost.c
> > @@ -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/20230606094159.1910369-1-masahiroy@kernel.org/
>

Uh, thanks for doing this!

>
>
> 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?
Masahiro Yamada June 8, 2023, 12:42 a.m. UTC | #3
On Thu, Jun 8, 2023 at 5:06 AM Vincenzo Palazzo
<vincenzopalazzodev@gmail.com> wrote:
>
> > On Thu, Mar 9, 2023 at 9:01 PM Vincenzo Palazzo
> > <vincenzopalazzodev@gmail.com> wrote:
> > >
> > > Emit a warning when the mod description is missed and only
> > > when the W=1 is enabled.
> > >
> > > Reported-by: Roland Kletzing <devzero@web.de>
> > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=10770
> > > Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
> > > ---
> > >  scripts/mod/modpost.c | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> > > index efff8078e395..433518dfc472 100644
> > > --- a/scripts/mod/modpost.c
> > > +++ b/scripts/mod/modpost.c
> > > @@ -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/20230606094159.1910369-1-masahiroy@kernel.org/
> >
>
> Uh, thanks for doing this!
>
> >
> >
> > 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.
Vincenzo Palazzo June 15, 2023, 11:28 p.m. UTC | #4
> On Thu, Mar 9, 2023 at 9:01 PM Vincenzo Palazzo
> <vincenzopalazzodev@gmail.com> wrote:
> >
> > Emit a warning when the mod description is missed and only
> > when the W=1 is enabled.
> >
> > Reported-by: Roland Kletzing <devzero@web.de>
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=10770
> > Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
> > ---
> >  scripts/mod/modpost.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> > index efff8078e395..433518dfc472 100644
> > --- a/scripts/mod/modpost.c
> > +++ b/scripts/mod/modpost.c
> > @@ -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.

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.

> I did a ground work:
> https://patchwork.kernel.org/project/linux-kbuild/patch/20230606094159.1910369-1-masahiroy@kernel.org/
>
>
>
> 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.
diff mbox series

Patch

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index efff8078e395..433518dfc472 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -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);