module: potential uninitialized return in module_kallsyms_on_each_symbol()

Smatch complains that:

	kernel/module.c:4472 module_kallsyms_on_each_symbol()
        error: uninitialized symbol 'ret'.

This warning looks like it could be correct if the &modules list is
empty.

Fixes: 013c1667cf ("kallsyms: refactor {,module_}kallsyms_on_each_symbol")
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
This commit is contained in:
Dan Carpenter 2021-02-10 13:57:07 +03:00 committed by Jessica Yu
parent 367948220f
commit 1e80d9cb57
1 changed files with 1 additions and 1 deletions

View File

@ -4388,7 +4388,7 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
{ {
struct module *mod; struct module *mod;
unsigned int i; unsigned int i;
int ret; int ret = 0;
mutex_lock(&module_mutex); mutex_lock(&module_mutex);
list_for_each_entry(mod, &modules, list) { list_for_each_entry(mod, &modules, list) {