1. 07 May, 2022 4 commits
    • Masahiro Yamada's avatar
      modpost: remove annoying namespace_from_kstrtabns() · 79f646e8
      Masahiro Yamada authored
      There are two call sites for sym_update_namespace().
      
      When the symbol has no namespace, s->namespace is set to NULL,
      but the conversion from "" to NULL is done in two different places.
      
      [1] read_symbols()
      
        This gets the namespace from __kstrtabns_<symbol>. If the symbol has
        no namespace, sym_get_data(info, sym) returns the empty string "".
        namespace_from_kstrtabns() converts it to NULL before it is passed to
        sym_update_namespace().
      
      [2] read_dump()
      
        This gets the namespace from the dump file, *.symvers. If the symbol
        has no namespace, the 'namespace' is the empty string "", which is
        directly passed into sym_update_namespace(). The conversion from
        "" to NULL is done in sym_update_namespace().
      
      namespace_from_kstrtabns() exists only for creating this inconsistency.
      
      Remove namespace_from_kstrtabns() so that sym_update_namespace() is
      consistently passed with "" instead of NULL.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      79f646e8
    • Masahiro Yamada's avatar
      modpost: remove redundant initializes for static variables · b5f1a52a
      Masahiro Yamada authored
      These are initialized with zeros without explicit initializers.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      b5f1a52a
    • Masahiro Yamada's avatar
      modpost: move export_from_secname() call to more relevant place · 535b3e05
      Masahiro Yamada authored
      The assigned 'export' is only used when
      
          if (strstarts(symname, "__ksymtab_"))
      
      is met. The else-part of the assignment is the dead code.
      
      Move the export_from_secname() call to where it is used.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      535b3e05
    • Masahiro Yamada's avatar
      modpost: remove useless export_from_sec() · 7ce3e410
      Masahiro Yamada authored
      With commit 1743694e ("modpost: stop symbol preloading for
      modversion CRC") applied, now export_from_sec() is useless.
      
      handle_symbol() is called for every symbol in the ELF.
      
      When 'symname' does not start with "__ksymtab", export_from_sec() is
      called, and the returned value is stored in 'export'.
      
      It is used in the last part of handle_symbol():
      
          if (strstarts(symname, "__ksymtab_")) {
                  name = symname + strlen("__ksymtab_");
                  sym_add_exported(name, mod, export);
          }
      
      'export' is used only when 'symname' starts with "__ksymtab_".
      
      So, the value returned by export_from_sec() is never used.
      
      Remove useless export_from_sec(). This makes further cleanups possible.
      
      I put the temporary code:
      
          export = export_unknown;
      
      Otherwise, I would get the compiler warning:
      
          warning: 'export' may be used uninitialized in this function [-Wmaybe-uninitialized]
      
      This is apparently false positive because
      
          if (strstarts(symname, "__ksymtab_")
      
      ... is a stronger condition than:
      
          if (strstarts(symname, "__ksymtab")
      
      Anyway, this part will be cleaned up by the next commit.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      7ce3e410
  2. 06 Apr, 2022 3 commits
  3. 05 Apr, 2022 2 commits
  4. 03 Apr, 2022 8 commits
  5. 02 Apr, 2022 23 commits