modpost: file2alias: check prototype of handler
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 22 Nov 2018 04:28:42 +0000 (13:28 +0900)
committerDanny Wood <danwood76@gmail.com>
Thu, 28 Jan 2021 10:29:13 +0000 (10:29 +0000)
[ Upstream commit f880eea68fe593342fa6e09be9bb661f3c297aec ]

Use specific prototype instead of an opaque pointer so that the
compiler can catch function prototype mismatch.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Mathieu Malaterre <malat@debian.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Change-Id: I522d2ef030c5a98fc06c3b9c93c7be34b750d037

scripts/mod/file2alias.c

index f2828174788a648db3132ac50b99121bc06eb01f..2f88e2f708836d6a86cf56edfd9c94967faeecf9 100644 (file)
@@ -44,7 +44,7 @@ typedef unsigned char __u8;
 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
@@ -1088,12 +1088,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. */
@@ -1197,7 +1196,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;
                        }
                }