提交 7de43cb7 编写于 作者: M Masahiro Yamada 提交者: Greg Kroah-Hartman

modpost: file2alias: check prototype of handler

[ Upstream commit f880eea68fe593342fa6e09be9bb661f3c297aec ]

Use specific prototype instead of an opaque pointer so that the
compiler can catch function prototype mismatch.
Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: NMathieu Malaterre <malat@debian.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 aa0e8cc9
...@@ -47,7 +47,7 @@ typedef struct { ...@@ -47,7 +47,7 @@ typedef struct {
struct devtable { struct devtable {
const char *device_id; /* name of table, __mod_<name>__*_device_table. */ const char *device_id; /* name of table, __mod_<name>__*_device_table. */
unsigned long id_size; 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 /* Define a variable f that holds the value of field f of struct devid
...@@ -1288,12 +1288,11 @@ static bool sym_is(const char *name, unsigned namelen, const char *symbol) ...@@ -1288,12 +1288,11 @@ static bool sym_is(const char *name, unsigned namelen, const char *symbol)
static void do_table(void *symval, unsigned long size, static void do_table(void *symval, unsigned long size,
unsigned long id_size, unsigned long id_size,
const char *device_id, const char *device_id,
void *function, int (*do_entry)(const char *filename, void *symval, char *alias),
struct module *mod) struct module *mod)
{ {
unsigned int i; unsigned int i;
char alias[500]; char alias[500];
int (*do_entry)(const char *, void *entry, char *alias) = function;
device_id_check(mod->name, device_id, size, id_size, symval); device_id_check(mod->name, device_id, size, id_size, symval);
/* Leave last one: it's the terminator. */ /* Leave last one: it's the terminator. */
...@@ -1410,7 +1409,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, ...@@ -1410,7 +1409,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
if (sym_is(name, namelen, p->device_id)) { if (sym_is(name, namelen, p->device_id)) {
do_table(symval, sym->st_size, p->id_size, do_table(symval, sym->st_size, p->id_size,
p->device_id, p->function, mod); p->device_id, p->do_entry, mod);
break; break;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册