[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKwvOdmV55_q_niHFP26i9US9OBbTaHVNDhOya+yLR2CTEZLjA@mail.gmail.com>
Date: Mon, 25 Jul 2022 09:53:22 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org,
Michal Marek <michal.lkml@...kovi.net>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] modpost: use sym_get_data() to get module
device_table data
On Tue, Jul 19, 2022 at 9:53 AM Masahiro Yamada <masahiroy@...nel.org> wrote:
>
> Use sym_get_data() to replace the long code.
>
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
> ---
>
> scripts/mod/file2alias.c | 4 +---
> scripts/mod/modpost.c | 2 +-
> scripts/mod/modpost.h | 1 +
> 3 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
> index cbd6b0f48b4e..80d973144fde 100644
> --- a/scripts/mod/file2alias.c
> +++ b/scripts/mod/file2alias.c
> @@ -1571,9 +1571,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
> zeros = calloc(1, sym->st_size);
> symval = zeros;
> } else {
> - symval = (void *)info->hdr
> - + info->sechdrs[get_secindex(info, sym)].sh_offset
> - + sym->st_value;
> + symval = sym_get_data(info, sym);
> }
>
> /* First handle the "special" cases */
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index 6370f9accb8e..26254e96c300 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -324,7 +324,7 @@ static void *sym_get_data_by_offset(const struct elf_info *info,
> return (void *)info->hdr + sechdr->sh_offset + offset;
> }
>
> -static void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym)
> +void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym)
> {
> return sym_get_data_by_offset(info, get_secindex(info, sym),
> sym->st_value);
> diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
> index 044bdfb894b7..4d8a1ae1d1e3 100644
> --- a/scripts/mod/modpost.h
> +++ b/scripts/mod/modpost.h
> @@ -187,6 +187,7 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen);
> /* from modpost.c */
> char *read_text_file(const char *filename);
> char *get_line(char **stringp);
> +void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym);
>
> enum loglevel {
> LOG_WARN,
> --
> 2.34.1
>
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists