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

Eugene Loh eugene.loh at oracle.com
Wed Apr 8 13:10:32 PDT 2020


lgtm


On 04/08/2020 08:00 AM, Kris Van Hees wrote:
> 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.
>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
>   libdtrace/dt_module.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libdtrace/dt_module.c b/libdtrace/dt_module.c
> index d9eb3a73..e66567f9 100644
> --- a/libdtrace/dt_module.c
> +++ b/libdtrace/dt_module.c
> @@ -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;
>   




More information about the DTrace-devel mailing list