From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>
Cc: Jessica Yu <jeyu@kernel.org>,
Rusty Russell <rusty@rustcorp.com.au>,
Mathieu Malaterre <malat@debian.org>,
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
Michal Marek <michal.lkml@markovi.net>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] modpost: file2alias: check prototype of handler
Date: Mon, 26 Nov 2018 23:53:30 +0900 [thread overview]
Message-ID: <CAK7LNAR7vGAjHbXSeE6yh4u8Dcr+ZZpADmxvBN9Co2=42=gXzg@mail.gmail.com> (raw)
In-Reply-To: <1542860922-9730-2-git-send-email-yamada.masahiro@socionext.com>
On Fri, Nov 23, 2018 at 1:51 AM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> Use specific prototype instead of an opaque pointer so that the
> compiler can catch incompatible pointer type.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
Applied to linux-kbuild.
> scripts/mod/file2alias.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
> index 7e4aede..a37af7d 100644
> --- a/scripts/mod/file2alias.c
> +++ b/scripts/mod/file2alias.c
> @@ -47,7 +47,7 @@ typedef struct {
> struct devtable {
> const char *device_id; /* name of table, __mod_<name>__*_device_table. */
> unsigned long id_size;
> - void *function;
> + int (*do_entry)(const char *filename, void *symval, char *alias);
> };
>
> /* Define a variable f that holds the value of field f of struct devid
> @@ -1299,12 +1299,11 @@ static bool sym_is(const char *name, unsigned namelen, const char *symbol)
> static void do_table(void *symval, unsigned long size,
> unsigned long id_size,
> const char *device_id,
> - void *function,
> + int (*do_entry)(const char *filename, void *symval, char *alias),
> struct module *mod)
> {
> unsigned int i;
> char alias[500];
> - int (*do_entry)(const char *, void *entry, char *alias) = function;
>
> device_id_check(mod->name, device_id, size, id_size, symval);
> /* Leave last one: it's the terminator. */
> @@ -1420,7 +1419,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
>
> if (sym_is(name, namelen, p->device_id)) {
> do_table(symval, sym->st_size, p->id_size,
> - p->device_id, p->function, mod);
> + p->device_id, p->do_entry, mod);
> break;
> }
> }
> --
> 2.7.4
>
--
Best Regards
Masahiro Yamada
next prev parent reply other threads:[~2018-11-26 14:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-22 4:28 [PATCH 1/2] modpost: file2alias: go back to simple devtable lookup Masahiro Yamada
2018-11-22 4:28 ` [PATCH 2/2] modpost: file2alias: check prototype of handler Masahiro Yamada
2018-11-26 10:40 ` Mathieu Malaterre
2018-11-26 14:53 ` Masahiro Yamada [this message]
2018-11-26 10:39 ` [PATCH 1/2] modpost: file2alias: go back to simple devtable lookup Mathieu Malaterre
2018-11-26 14:53 ` Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAK7LNAR7vGAjHbXSeE6yh4u8Dcr+ZZpADmxvBN9Co2=42=gXzg@mail.gmail.com' \
--to=yamada.masahiro@socionext.com \
--cc=jeyu@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=malat@debian.org \
--cc=michal.lkml@markovi.net \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).