public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] tracing/kprobe: Fix uninitialized variable bug
@ 2020-02-05 22:34 Gustavo A. R. Silva
  2020-02-05 23:24 ` Tom Zanussi
  2020-02-05 23:45 ` Masami Hiramatsu
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2020-02-05 22:34 UTC (permalink / raw)
  To: Steven Rostedt (VMware), Ingo Molnar, Masami Hiramatsu,
	Tom Zanussi
  Cc: linux-kernel, Gustavo A. R. Silva

There is a potential execution path in which variable *ret* is returned
without being properly initialized, previously.

Fix this by initializing variable *ret* to 0.

Addresses-Coverity-ID: 1491142 ("Uninitialized scalar variable")
Fixes: 2a588dd1d5d6 ("tracing: Add kprobe event command generation functions")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 kernel/trace/trace_kprobe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index d8264ebb9581..362cca52f5de 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1012,7 +1012,7 @@ int __kprobe_event_add_fields(struct dynevent_cmd *cmd, ...)
 {
 	struct dynevent_arg arg;
 	va_list args;
-	int ret;
+	int ret = 0;
 
 	if (cmd->type != DYNEVENT_TYPE_KPROBE)
 		return -EINVAL;
-- 
2.25.0


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

end of thread, other threads:[~2020-02-05 23:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-05 22:34 [PATCH][next] tracing/kprobe: Fix uninitialized variable bug Gustavo A. R. Silva
2020-02-05 23:24 ` Tom Zanussi
2020-02-05 23:32   ` Gustavo A. R. Silva
2020-02-05 23:45 ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox