summaryrefslogtreecommitdiffstats
path: root/scripts/mod/file2alias.c
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-11-21 23:28:42 -0500
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-12-01 08:21:58 -0500
commitf880eea68fe593342fa6e09be9bb661f3c297aec (patch)
treee7c4d4a1e6b68b124929566e2615cac89924f123 /scripts/mod/file2alias.c
parentec91e78d378cc5d4b43805a1227d8e04e5dfa17d (diff)
modpost: file2alias: check prototype of handler
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>
Diffstat (limited to 'scripts/mod/file2alias.c')
-rw-r--r--scripts/mod/file2alias.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 7e4aededfd37..a37af7d71973 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -47,7 +47,7 @@ typedef struct {
47struct devtable { 47struct devtable {
48 const char *device_id; /* name of table, __mod_<name>__*_device_table. */ 48 const char *device_id; /* name of table, __mod_<name>__*_device_table. */
49 unsigned long id_size; 49 unsigned long id_size;
50 void *function; 50 int (*do_entry)(const char *filename, void *symval, char *alias);
51}; 51};
52 52
53/* Define a variable f that holds the value of field f of struct devid 53/* 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)
1299static void do_table(void *symval, unsigned long size, 1299static void do_table(void *symval, unsigned long size,
1300 unsigned long id_size, 1300 unsigned long id_size,
1301 const char *device_id, 1301 const char *device_id,
1302 void *function, 1302 int (*do_entry)(const char *filename, void *symval, char *alias),
1303 struct module *mod) 1303 struct module *mod)
1304{ 1304{
1305 unsigned int i; 1305 unsigned int i;
1306 char alias[500]; 1306 char alias[500];
1307 int (*do_entry)(const char *, void *entry, char *alias) = function;
1308 1307
1309 device_id_check(mod->name, device_id, size, id_size, symval); 1308 device_id_check(mod->name, device_id, size, id_size, symval);
1310 /* Leave last one: it's the terminator. */ 1309 /* Leave last one: it's the terminator. */
@@ -1420,7 +1419,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1420 1419
1421 if (sym_is(name, namelen, p->device_id)) { 1420 if (sym_is(name, namelen, p->device_id)) {
1422 do_table(symval, sym->st_size, p->id_size, 1421 do_table(symval, sym->st_size, p->id_size,
1423 p->device_id, p->function, mod); 1422 p->device_id, p->do_entry, mod);
1424 break; 1423 break;
1425 } 1424 }
1426 } 1425 }