lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090506143608.GA29044@elte.hu>
Date:	Wed, 6 May 2009 16:36:08 +0200
From:	Ingo Molnar <mingo@...e.hu>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	mingo@...hat.com, hpa@...or.com, linux-kernel@...r.kernel.org,
	jaswinder@...nel.org, jaswinderrajput@...il.com,
	tglx@...utronix.de, linux-tip-commits@...r.kernel.org
Subject: Re: [tip:tracing/core] tracing: trace_output.c, fix false positive
	compiler warning


* Steven Rostedt <rostedt@...dmis.org> wrote:

> 
> On Wed, 6 May 2009, tip-bot for Jaswinder Singh Rajput wrote:
> 
> > Commit-ID:  48dd0fed90e2b1f1ba87401439b85942181c6df3
> > Gitweb:     http://git.kernel.org/tip/48dd0fed90e2b1f1ba87401439b85942181c6df3
> > Author:     Jaswinder Singh Rajput <jaswinder@...nel.org>
> > AuthorDate: Wed, 6 May 2009 15:45:45 +0530
> > Committer:  Ingo Molnar <mingo@...e.hu>
> > CommitDate: Wed, 6 May 2009 14:19:16 +0200
> > 
> > tracing: trace_output.c, fix false positive compiler warning
> > 
> > This compiler warning:
> > 
> >   CC      kernel/trace/trace_output.o
> >  kernel/trace/trace_output.c: In function ?register_ftrace_event?:
> >  kernel/trace/trace_output.c:544: warning: ?list? may be used uninitialized in this function
> > 
> > Is wrong as 'list' is always initialized - but GCC (4.3.2) does not
> > recognize this relationship properly.
> > 
> > Work around the warning by initializing the variable to NULL.
> > 
> > [ Impact: fix false positive compiler warning ]
> > 
> > Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@...il.com>
> > Acked-by: Steven Rostedt <rostedt@...dmis.org>
> > LKML-Reference: <new-submission>
> > Signed-off-by: Ingo Molnar <mingo@...e.hu>
> > 
> > 
> > ---
> >  kernel/trace/trace_output.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> > index 5fc51f0..8bd9a2c 100644
> > --- a/kernel/trace/trace_output.c
> > +++ b/kernel/trace/trace_output.c
> > @@ -541,7 +541,7 @@ int register_ftrace_event(struct trace_event *event)
> >  	INIT_LIST_HEAD(&event->list);
> >  
> >  	if (!event->type) {
> > -		struct list_head *list;
> > +		struct list_head *list = NULL;
> 
> Actually this is the wrong place to initialize. The correct place 
> is in the function that is expected to.

does it really matter? It's far more robust to initialize at the 
definition site, because there we can be sure there's no 
side-effects. This one:

>  	/* Did we used up all 65 thousand events??? */
> -	if ((last + 1) > FTRACE_MAX_EVENT)
> +	if ((last + 1) > FTRACE_MAX_EVENT) {
> +		*list = NULL;
>  		return 0;
> +	}

Is correct too but needs a semantic check (and ongoing maintenance, 
etc.).

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ