[DTrace-devel] [PATCH 22/47] Avoid valgrind warning about conditional jump based on uninitialized value

Kris Van Hees kris.van.hees at oracle.com
Sun May 3 20:17:28 PDT 2020


The dt_modsym_update_alt() has conditionals based on the content of
sym_name, which is initialized from  a sscanf() statement.  While the
implementation ensures that a value is assigned, valgrind does not seem
to know that.  By providing a default initializer value, complaints go
away.

Orabug: 31220517
Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
---
 libdtrace/dt_module.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libdtrace/dt_module.c b/libdtrace/dt_module.c
index d9eb3a73..28a5dbec 100644
--- a/libdtrace/dt_module.c
+++ b/libdtrace/dt_module.c
@@ -1,6 +1,6 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
  * Licensed under the Universal Permissive License v 1.0 as shown at
  * http://oss.oracle.com/licenses/upl.
  */
@@ -1315,7 +1315,7 @@ dt_modsym_update_alt(dtrace_hdl_t *dtp, const char *line)
 	int sym_text;
 	dt_module_t *dmp;
 	dtrace_addr_range_t *range = NULL;
-	char sym_name[KSYM_NAME_MAX];
+	char sym_name[KSYM_NAME_MAX] = "";
 	char mod_name[PATH_MAX] = "vmlinux]";	/* note trailing ] */
 	int skip = 0;
 
-- 
2.26.0




More information about the DTrace-devel mailing list