Re: [PATCH 1/2] tracing: Kill uninitialized warning intrace_printk.c

From: Steven Rostedt
Date: Fri Sep 23 2011 - 10:23:19 EST


On Fri, 2011-09-23 at 17:19 +0300, penberg@xxxxxxxxxxxxxx wrote:
> From: Pekka Enberg <penberg@xxxxxxxxxx>
>
> This patch kill the following bogus warning issued by GCC by shuffling the code
> around:
>
> CC fs/ext4/balloc.o
> kernel/trace/trace_printk.c: In function âmodule_trace_bprintk_format_notifyâ:
> kernel/trace/trace_printk.c:65:14: warning: âfmtâ may be used uninitialized in this function [-Wuninitialized]
> kernel/trace/trace_printk.c:52:8: note: âfmtâ was declared here
>

NAK, I have a fix I just posted yesterday ;)

https://lkml.org/lkml/2011/9/22/402

-- Steve

> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
> ---
> kernel/trace/trace_printk.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
> index 1f06468..25e34f5 100644
> --- a/kernel/trace/trace_printk.c
> +++ b/kernel/trace/trace_printk.c
> @@ -49,7 +49,7 @@ static
> void hold_module_trace_bprintk_format(const char **start, const char **end)
> {
> const char **iter;
> - char *fmt;
> + char *fmt = NULL;
>
> mutex_lock(&btrace_mutex);
> for (iter = start; iter < end; iter++) {
> @@ -62,7 +62,7 @@ void hold_module_trace_bprintk_format(const char **start, const char **end)
> tb_fmt = kmalloc(sizeof(*tb_fmt), GFP_KERNEL);
> if (tb_fmt)
> fmt = kmalloc(strlen(*iter) + 1, GFP_KERNEL);
> - if (tb_fmt && fmt) {
> + if (fmt) {
> list_add_tail(&tb_fmt->list, &trace_bprintk_fmt_list);
> strcpy(fmt, *iter);
> tb_fmt->fmt = fmt;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/