diff mbox series

[2/5] modpost: remove the unused argument of check_sec_ref()

Message ID 20220523164626.858340-2-masahiroy@kernel.org (mailing list archive)
State New
Headers show
Series [1/5] modpost: fix undefined behavior of is_arm_mapping_symbol() | expand

Commit Message

Masahiro Yamada May 23, 2022, 4:46 p.m. UTC
check_sec_ref() does not use the first parameter 'mod'.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/mod/modpost.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Nick Desaulniers May 24, 2022, 8:44 p.m. UTC | #1
On Mon, May 23, 2022 at 9:48 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> check_sec_ref() does not use the first parameter 'mod'.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Perhaps we could enable some -W flags for scripts/mod/?
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>
>  scripts/mod/modpost.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index 845bc438ca49..843c64eebe8b 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -1883,8 +1883,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
>   * to find all references to a section that reference a section that will
>   * be discarded and warns about it.
>   **/
> -static void check_sec_ref(struct module *mod, const char *modname,
> -                         struct elf_info *elf)
> +static void check_sec_ref(const char *modname, struct elf_info *elf)
>  {
>         int i;
>         Elf_Shdr *sechdrs = elf->sechdrs;
> @@ -2069,7 +2068,7 @@ static void read_symbols(const char *modname)
>                                              sym_get_data(&info, sym));
>         }
>
> -       check_sec_ref(mod, modname, &info);
> +       check_sec_ref(modname, &info);
>
>         if (!mod->is_vmlinux) {
>                 version = get_modinfo(&info, "version");
> --
> 2.32.0
>
Masahiro Yamada May 26, 2022, 10:47 a.m. UTC | #2
On Wed, May 25, 2022 at 5:44 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Mon, May 23, 2022 at 9:48 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > check_sec_ref() does not use the first parameter 'mod'.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
>
> Perhaps we could enable some -W flags for scripts/mod/?
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
> > ---


Thanks for your advice.

-Wunused-parameter found more.

At least, we can clean up find_extable_entry_size().




  HOSTCC  scripts/mod/mk_elfconfig
scripts/mod/mk_elfconfig.c: In function ‘main’:
scripts/mod/mk_elfconfig.c:8:10: warning: unused parameter ‘argc’
[-Wunused-parameter]
    8 | main(int argc, char **argv)
      |      ~~~~^~~~
scripts/mod/mk_elfconfig.c:8:23: warning: unused parameter ‘argv’
[-Wunused-parameter]
    8 | main(int argc, char **argv)
      |                ~~~~~~~^~~~
  CC      scripts/mod/empty.o
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/modpost.o
scripts/mod/modpost.c: In function ‘find_extable_entry_size’:
scripts/mod/modpost.c:1538:55: warning: unused parameter ‘sec’
[-Wunused-parameter]
 1538 | static void find_extable_entry_size(const char* const sec,
const Elf_Rela* r)
      |                                     ~~~~~~~~~~~~~~~~~~^~~
scripts/mod/modpost.c: In function ‘check_sec_ref’:
scripts/mod/modpost.c:1885:42: warning: unused parameter ‘mod’
[-Wunused-parameter]
 1885 | static void check_sec_ref(struct module *mod, const char *modname,
      |                           ~~~~~~~~~~~~~~~^~~
  CC      scripts/mod/devicetable-offsets.s
  HOSTCC  scripts/mod/file2alias.o
scripts/mod/file2alias.c: In function ‘do_hid_entry’:
scripts/mod/file2alias.c:399:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
  399 | static int do_hid_entry(const char *filename,
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_ieee1394_entry’:
scripts/mod/file2alias.c:417:42: warning: unused parameter ‘filename’
[-Wunused-parameter]
  417 | static int do_ieee1394_entry(const char *filename,
      |                              ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_ccw_entry’:
scripts/mod/file2alias.c:497:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
  497 | static int do_ccw_entry(const char *filename,
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_ap_entry’:
scripts/mod/file2alias.c:520:36: warning: unused parameter ‘filename’
[-Wunused-parameter]
  520 | static int do_ap_entry(const char *filename,
      |                        ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_css_entry’:
scripts/mod/file2alias.c:530:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
  530 | static int do_css_entry(const char *filename,
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_serio_entry’:
scripts/mod/file2alias.c:540:39: warning: unused parameter ‘filename’
[-Wunused-parameter]
  540 | static int do_serio_entry(const char *filename,
      |                           ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_acpi_entry’:
scripts/mod/file2alias.c:565:38: warning: unused parameter ‘filename’
[-Wunused-parameter]
  565 | static int do_acpi_entry(const char *filename,
      |                          ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_pcmcia_entry’:
scripts/mod/file2alias.c:682:40: warning: unused parameter ‘filename’
[-Wunused-parameter]
  682 | static int do_pcmcia_entry(const char *filename,
      |                            ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_vio_entry’:
scripts/mod/file2alias.c:718:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
  718 | static int do_vio_entry(const char *filename, void *symval,
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_input_entry’:
scripts/mod/file2alias.c:752:39: warning: unused parameter ‘filename’
[-Wunused-parameter]
  752 | static int do_input_entry(const char *filename, void *symval,
      |                           ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_eisa_entry’:
scripts/mod/file2alias.c:809:38: warning: unused parameter ‘filename’
[-Wunused-parameter]
  809 | static int do_eisa_entry(const char *filename, void *symval,
      |                          ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_parisc_entry’:
scripts/mod/file2alias.c:821:40: warning: unused parameter ‘filename’
[-Wunused-parameter]
  821 | static int do_parisc_entry(const char *filename, void *symval,
      |                            ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_sdio_entry’:
scripts/mod/file2alias.c:840:38: warning: unused parameter ‘filename’
[-Wunused-parameter]
  840 | static int do_sdio_entry(const char *filename,
      |                          ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_ssb_entry’:
scripts/mod/file2alias.c:856:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
  856 | static int do_ssb_entry(const char *filename,
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_bcma_entry’:
scripts/mod/file2alias.c:872:38: warning: unused parameter ‘filename’
[-Wunused-parameter]
  872 | static int do_bcma_entry(const char *filename,
      |                          ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_virtio_entry’:
scripts/mod/file2alias.c:890:40: warning: unused parameter ‘filename’
[-Wunused-parameter]
  890 | static int do_virtio_entry(const char *filename, void *symval,
      |                            ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_vmbus_entry’:
scripts/mod/file2alias.c:910:39: warning: unused parameter ‘filename’
[-Wunused-parameter]
  910 | static int do_vmbus_entry(const char *filename, void *symval,
      |                           ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_rpmsg_entry’:
scripts/mod/file2alias.c:927:39: warning: unused parameter ‘filename’
[-Wunused-parameter]
  927 | static int do_rpmsg_entry(const char *filename, void *symval,
      |                           ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_i2c_entry’:
scripts/mod/file2alias.c:937:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
  937 | static int do_i2c_entry(const char *filename, void *symval,
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_i3c_entry’:
scripts/mod/file2alias.c:946:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
  946 | static int do_i3c_entry(const char *filename, void *symval,
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_spi_entry’:
scripts/mod/file2alias.c:965:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
  965 | static int do_spi_entry(const char *filename, void *symval,
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_dmi_entry’:
scripts/mod/file2alias.c:1006:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1006 | static int do_dmi_entry(const char *filename, void *symval,
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_platform_entry’:
scripts/mod/file2alias.c:1030:42: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1030 | static int do_platform_entry(const char *filename,
      |                              ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_mdio_entry’:
scripts/mod/file2alias.c:1038:38: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1038 | static int do_mdio_entry(const char *filename,
      |                          ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_zorro_entry’:
scripts/mod/file2alias.c:1063:39: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1063 | static int do_zorro_entry(const char *filename, void *symval,
      |                           ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_isapnp_entry’:
scripts/mod/file2alias.c:1073:40: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1073 | static int do_isapnp_entry(const char *filename,
      |                            ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_ipack_entry’:
scripts/mod/file2alias.c:1088:39: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1088 | static int do_ipack_entry(const char *filename,
      |                           ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_mips_cdmm_entry’:
scripts/mod/file2alias.c:1178:43: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1178 | static int do_mips_cdmm_entry(const char *filename,
      |                               ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_x86cpu_entry’:
scripts/mod/file2alias.c:1193:40: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1193 | static int do_x86cpu_entry(const char *filename, void *symval,
      |                            ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_cpu_entry’:
scripts/mod/file2alias.c:1212:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1212 | static int do_cpu_entry(const char *filename, void *symval, char *alias)
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_mei_entry’:
scripts/mod/file2alias.c:1221:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1221 | static int do_mei_entry(const char *filename, void *symval,
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_rio_entry’:
scripts/mod/file2alias.c:1239:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1239 | static int do_rio_entry(const char *filename,
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_ulpi_entry’:
scripts/mod/file2alias.c:1258:38: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1258 | static int do_ulpi_entry(const char *filename, void *symval,
      |                          ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_hda_entry’:
scripts/mod/file2alias.c:1270:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1270 | static int do_hda_entry(const char *filename, void *symval, char *alias)
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_sdw_entry’:
scripts/mod/file2alias.c:1286:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1286 | static int do_sdw_entry(const char *filename, void *symval, char *alias)
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_fsl_mc_entry’:
scripts/mod/file2alias.c:1304:40: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1304 | static int do_fsl_mc_entry(const char *filename, void *symval,
      |                            ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_tbsvc_entry’:
scripts/mod/file2alias.c:1315:39: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1315 | static int do_tbsvc_entry(const char *filename, void *symval,
char *alias)
      |                           ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_typec_entry’:
scripts/mod/file2alias.c:1339:39: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1339 | static int do_typec_entry(const char *filename, void *symval,
char *alias)
      |                           ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_tee_entry’:
scripts/mod/file2alias.c:1351:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1351 | static int do_tee_entry(const char *filename, void *symval, char *alias)
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_mhi_entry’:
scripts/mod/file2alias.c:1387:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1387 | static int do_mhi_entry(const char *filename, void *symval, char *alias)
      |                         ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_ishtp_entry’:
scripts/mod/file2alias.c:1395:39: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1395 | static int do_ishtp_entry(const char *filename, void *symval,
char *alias)
      |                           ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_auxiliary_entry’:
scripts/mod/file2alias.c:1406:43: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1406 | static int do_auxiliary_entry(const char *filename, void
*symval, char *alias)
      |                               ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_ssam_entry’:
scripts/mod/file2alias.c:1419:38: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1419 | static int do_ssam_entry(const char *filename, void *symval,
char *alias)
      |                          ~~~~~~~~~~~~^~~~~~~~
scripts/mod/file2alias.c: In function ‘do_dfl_entry’:
scripts/mod/file2alias.c:1437:37: warning: unused parameter ‘filename’
[-Wunused-parameter]
 1437 | static int do_dfl_entry(const char *filename, void *symval, char *alias)
      |                         ~~~~~~~~~~~~^~~~~~~~











> >
> >  scripts/mod/modpost.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> > index 845bc438ca49..843c64eebe8b 100644
> > --- a/scripts/mod/modpost.c
> > +++ b/scripts/mod/modpost.c
> > @@ -1883,8 +1883,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
> >   * to find all references to a section that reference a section that will
> >   * be discarded and warns about it.
> >   **/
> > -static void check_sec_ref(struct module *mod, const char *modname,
> > -                         struct elf_info *elf)
> > +static void check_sec_ref(const char *modname, struct elf_info *elf)
> >  {
> >         int i;
> >         Elf_Shdr *sechdrs = elf->sechdrs;
> > @@ -2069,7 +2068,7 @@ static void read_symbols(const char *modname)
> >                                              sym_get_data(&info, sym));
> >         }
> >
> > -       check_sec_ref(mod, modname, &info);
> > +       check_sec_ref(modname, &info);
> >
> >         if (!mod->is_vmlinux) {
> >                 version = get_modinfo(&info, "version");
> > --
> > 2.32.0
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers
diff mbox series

Patch

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 845bc438ca49..843c64eebe8b 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1883,8 +1883,7 @@  static void section_rel(const char *modname, struct elf_info *elf,
  * to find all references to a section that reference a section that will
  * be discarded and warns about it.
  **/
-static void check_sec_ref(struct module *mod, const char *modname,
-			  struct elf_info *elf)
+static void check_sec_ref(const char *modname, struct elf_info *elf)
 {
 	int i;
 	Elf_Shdr *sechdrs = elf->sechdrs;
@@ -2069,7 +2068,7 @@  static void read_symbols(const char *modname)
 					     sym_get_data(&info, sym));
 	}
 
-	check_sec_ref(mod, modname, &info);
+	check_sec_ref(modname, &info);
 
 	if (!mod->is_vmlinux) {
 		version = get_modinfo(&info, "version");