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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 20 Mar 2010 16:56:04 +0300
From:	Dan Carpenter <error27@...il.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Ingo Molnar <mingo@...hat.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Li Zefan <lizf@...fujitsu.com>,
	Tom Zanussi <tzanussi@...il.com>, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: Re: [patch] trace: find the correct ftrace event

On Sat, Mar 20, 2010 at 09:37:13AM -0400, Steven Rostedt wrote:
> On Sat, 2010-03-20 at 16:19 +0300, Dan Carpenter wrote:
> > The original code doesn't work because "call" is never NULL there.
> 
> A one line change would have done the same ;-)
> 
> > Signed-off-by: Dan Carpenter <error27@...il.com>
> > ---
> > My code should work, but it seems like there should but it seems like
> > there should be a more elegant way to do this?
> > 
> > diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
> > index 4615f62..6070c70 100644
> > --- a/kernel/trace/trace_events_filter.c
> > +++ b/kernel/trace/trace_events_filter.c
> > @@ -1388,16 +1388,19 @@ int ftrace_profile_set_filter(struct perf_event *event, int event_id,
> >  	struct event_filter *filter;
> >  	struct filter_parse_state *ps;
> >  	struct ftrace_event_call *call = NULL;
> > +	int found = 0;
> >  
> >  	mutex_lock(&event_mutex);
> >  
> >  	list_for_each_entry(call, &ftrace_events, list) {
> > -		if (call->id == event_id)
> > +		if (call->id == event_id) {
> > +			found = 1;
> >  			break;
> > +		}
> >  	}
> >  
> >  	err = -EINVAL;
> > -	if (!call)
> 
> 	if (call == &ftrace_events)
> 

Man...  That makes my head hurt.  It only works because ->list is the 
first element in the struct.

We'd need a cast.

Is that really cleaner?

regards,
dan carpenter

> -- Steve
> 
> > +	if (!found)
> >  		goto out_unlock;
> >  
> >  	err = -EEXIST;
> 
> 
> --
> 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/
--
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