Skip to content

Commit f880eea

Browse files
committed
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 <[email protected]> Reviewed-by: Mathieu Malaterre <[email protected]>
1 parent ec91e78 commit f880eea

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

scripts/mod/file2alias.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ typedef struct {
4747
struct devtable {
4848
const char *device_id; /* name of table, __mod_<name>__*_device_table. */
4949
unsigned long id_size;
50-
void *function;
50+
int (*do_entry)(const char *filename, void *symval, char *alias);
5151
};
5252

5353
/* 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)
12991299
static void do_table(void *symval, unsigned long size,
13001300
unsigned long id_size,
13011301
const char *device_id,
1302-
void *function,
1302+
int (*do_entry)(const char *filename, void *symval, char *alias),
13031303
struct module *mod)
13041304
{
13051305
unsigned int i;
13061306
char alias[500];
1307-
int (*do_entry)(const char *, void *entry, char *alias) = function;
13081307

13091308
device_id_check(mod->name, device_id, size, id_size, symval);
13101309
/* Leave last one: it's the terminator. */
@@ -1420,7 +1419,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
14201419

14211420
if (sym_is(name, namelen, p->device_id)) {
14221421
do_table(symval, sym->st_size, p->id_size,
1423-
p->device_id, p->function, mod);
1422+
p->device_id, p->do_entry, mod);
14241423
break;
14251424
}
14261425
}

0 commit comments

Comments
 (0)