Skip to contentSkip to conversation

module: potential uninitialized return in module_kallsyms_on_each_symbol()

PATCH Applied Dan Carpenter 4 participants 4 messages Feb 10, 2021 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 013c1667cf78 ("kallsyms: refactor {,module_}kallsyms_on_each_symbol")
---
 kernel/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/module.c +1 -1
index 95186c9d81ea..9bd3c821d029 100644
@@ -4447,7 +4447,7 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
 {
 	struct module *mod;
 	unsigned int i;
-	int ret;
+	int ret = 0;
 
 	mutex_lock(&module_mutex);
 	list_for_each_entry(mod, &modules, list) {
Signature · 1 line
2.30.0
Applied
#3 lore raw
In reply to Dan Carpenter

+++ Dan Carpenter [10/02/21 13:57 +0300]:

Quoted 10 lines

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 013c1667cf78 ("kallsyms: refactor {,module_}kallsyms_on_each_symbol")

Applied, thanks!

Jessica