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]
Date:	Fri, 8 May 2009 07:35:22 -0400 (EDT)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Frederic Weisbecker <fweisbec@...il.com>
cc:	Li Zefan <lizf@...fujitsu.com>, Ingo Molnar <mingo@...e.hu>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] tracing/events: clean up for
 ftrace_set_clr_event()


On Fri, 8 May 2009, Frederic Weisbecker wrote:
> >  
> > -static int ftrace_set_clr_event(char *buf, int set)
> > +/*
> > + * __ftrace_set_clr_event(NULL, NULL, NULL, set) will set/unset all events.
> > + */
> > +static int __ftrace_set_clr_event(const char *match, const char *sub,
> > +				  const char *event, int set)
> >  {
> >  	struct ftrace_event_call *call;
> > +	int ret;
> > +
> > +	mutex_lock(&event_mutex);
> > +	list_for_each_entry(call, &ftrace_events, list) {
> > +
> > +		if (!call->name || !call->regfunc)
> > +			continue;
> > +
> > +		if (match &&
> > +		    strcmp(match, call->name) != 0 &&
> > +		    strcmp(match, call->system) != 0)
> > +			continue;
> > +
> > +		if (sub && strcmp(sub, call->system) != 0)
> > +			continue;
> > +
> > +		if (event && strcmp(event, call->name) != 0)
> > +			continue;
> 
> 
> Neat: You can simply use !strcmp(...)

Hehe, no he can't. It would be "strcmp(...)" for the true case. This is 
exactly why I prefer to use "strcmp(...) != 0" over "!strcmp(...)". 
Because, like you, I've confused "!strcmp(...)" too many times as "not a 
match" when it in fact means "is a match".

I've made this mistake enough that I've given up on using just "strcmp" or 
"!strcmp". "strcmp() != 0" and "strcmp() == 0" show what you want much 
better.

-- Steve

--
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