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:	Mon, 6 Apr 2015 07:52:37 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Guilherme Cox <cox@...puter.org>,
	Tony Luck <tony.luck@...il.com>,
	Xie XiuQi <xiexiuqi@...wei.com>
Subject: Re: [PATCH 07/18 v3] tracing: Add TRACE_DEFINE_ENUM() macro to map
 enums to their values

On Mon, 6 Apr 2015 13:54:33 +0900
Namhyung Kim <namhyung@...nel.org> wrote:


> > +		if (isalpha(*ptr) || *ptr == '_') {
> > +			if (strncmp(map->enum_string, ptr, len) == 0 &&
> > +			    !isalnum(ptr[len]) && ptr[len] != '_') {
> > +				ptr = enum_replace(ptr, map, len);
> > +				/* Hmm, enum string smaller than value */
> > +				if (WARN_ON_ONCE(!ptr))
> > +					return;
> > +				/*
> > +				 * No need to decrement here, as enum_replace()
> > +				 * returns the pointer to the character passed
> > +				 * the enum, and two enums can not be placed
> > +				 * back to back without something in between.
> > +				 * We can skip that something in between.
> > +				 */
> > +				continue;
> 
> Maybe I'm becoming a bit paranoid, what I worried was like this:
> 
>   ENUM1\"ENUM2\"
> 
> In this case, it skips the backslash and makes quotation effective..

The only time a backslash is OK is if it's in a quote, where we do not
process enums there anyway.

The above isn't valid C outside of quotes, so I'm still not worried.

> 
> 
> > +			}
> > +		skip_more:
> > +			do {
> > +				ptr++;
> > +			} while (isalnum(*ptr) || *ptr == '_');
> > +			/*
> > +			 * If what comes after this variable is a '.' or
> > +			 * '->' then we can continue to ignore that string.
> > +			 */
> > +			if (*ptr == '.' || (ptr[0] == '-' && ptr[1] == '>')) {
> > +				ptr += *ptr == '.' ? 1 : 2;
> > +				goto skip_more;
> > +			}
> > +			/*
> > +			 * Once again, we can skip the delimiter that came
> > +			 * after the string.
> > +			 */
> > +			continue;
> > +		}
> > +	}
> > +}
> > +
> > +void trace_event_enum_update(struct trace_enum_map **map, int len)
> > +{
> > +	struct ftrace_event_call *call, *p;
> > +	const char *last_system = NULL;
> > +	int last_i;
> > +	int i;
> > +
> > +	down_write(&trace_event_sem);
> > +	list_for_each_entry_safe(call, p, &ftrace_events, list) {
> > +		/* events are usually grouped together with systems */
> > +		if (!last_system || call->class->system != last_system) {
> 
> I think simply checking "call->class->system != last_system" would work.

I think you are correct, but I'm not sure I want to change it. Mainly
because it's more readable that way. The !last_system is basically the
"this is first time". Leaving it out may cause people to think it's
wrong.

But I may change my mind and remove it anyway ;-)

If there's other things wrong with this patch, I may update this too.

Thanks for reviewing.

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