linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] module: potential uninitialized return in module_kallsyms_on_each_symbol()
@ 2021-02-10 10:57 Dan Carpenter
  2021-02-10 11:59 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-02-10 10:57 UTC (permalink / raw)
  To: Jessica Yu, Christoph Hellwig
  Cc: Petr Mladek, Miroslav Benes, linux-kernel, kernel-janitors

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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 kernel/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/module.c b/kernel/module.c
index 95186c9d81ea..9bd3c821d029 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -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) {
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] module: potential uninitialized return in module_kallsyms_on_each_symbol()
  2021-02-10 10:57 [PATCH] module: potential uninitialized return in module_kallsyms_on_each_symbol() Dan Carpenter
@ 2021-02-10 11:59 ` Christoph Hellwig
  2021-02-10 12:08 ` Miroslav Benes
  2021-02-10 16:17 ` Jessica Yu
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-02-10 11:59 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jessica Yu, Christoph Hellwig, Petr Mladek, Miroslav Benes,
	linux-kernel, kernel-janitors

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] module: potential uninitialized return in module_kallsyms_on_each_symbol()
  2021-02-10 10:57 [PATCH] module: potential uninitialized return in module_kallsyms_on_each_symbol() Dan Carpenter
  2021-02-10 11:59 ` Christoph Hellwig
@ 2021-02-10 12:08 ` Miroslav Benes
  2021-02-10 16:17 ` Jessica Yu
  2 siblings, 0 replies; 4+ messages in thread
From: Miroslav Benes @ 2021-02-10 12:08 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jessica Yu, Christoph Hellwig, Petr Mladek, linux-kernel,
	kernel-janitors

On Wed, 10 Feb 2021, Dan Carpenter wrote:

> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Miroslav Benes <mbenes@suse.cz>

M

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] module: potential uninitialized return in module_kallsyms_on_each_symbol()
  2021-02-10 10:57 [PATCH] module: potential uninitialized return in module_kallsyms_on_each_symbol() Dan Carpenter
  2021-02-10 11:59 ` Christoph Hellwig
  2021-02-10 12:08 ` Miroslav Benes
@ 2021-02-10 16:17 ` Jessica Yu
  2 siblings, 0 replies; 4+ messages in thread
From: Jessica Yu @ 2021-02-10 16:17 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Christoph Hellwig, Petr Mladek, Miroslav Benes, linux-kernel,
	kernel-janitors

+++ Dan Carpenter [10/02/21 13:57 +0300]:
>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")
>Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks!

Jessica

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-10 16:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10 10:57 [PATCH] module: potential uninitialized return in module_kallsyms_on_each_symbol() Dan Carpenter
2021-02-10 11:59 ` Christoph Hellwig
2021-02-10 12:08 ` Miroslav Benes
2021-02-10 16:17 ` Jessica Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).