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:	Thu, 5 Feb 2015 16:29:33 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Al Viro <viro@...IV.linux.org.uk>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH 5/7] trace: make filter_parse_regex() provide the
 length of substring to compare with

On Thu,  5 Feb 2015 19:56:38 +0000
Al Viro <viro@...IV.linux.org.uk> wrote:

> From: Al Viro <viro@...iv.linux.org.uk>
> 
> ... by passing len by address and using it to report the length of
> substring in question.

You certainly are very verbose in your change logs.

What exactly is the purpose of this patch? Clean up? Optimization?

I can't really tell. Seems like you are just moving the strlen() from
outside the function into it.


> --- a/kernel/trace/trace.h
> +++ b/kernel/trace/trace.h
> @@ -1051,7 +1051,7 @@ struct filter_pred {
>  };
>  
>  extern enum regex_type
> -filter_parse_regex(char *buff, int len, char **search, int *not);
> +filter_parse_regex(char *buff, int *len, char **search, int *not);
>  extern void print_event_filter(struct ftrace_event_file *file,
>  			       struct trace_seq *s);
>  extern int apply_event_filter(struct ftrace_event_file *file,
> diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
> index 6c4a96b..6a659e1 100644
> --- a/kernel/trace/trace_events_filter.c
> +++ b/kernel/trace/trace_events_filter.c
> @@ -321,7 +321,7 @@ static int regex_match_end(char *str, struct regex *r, int len)
>   *  not returns 1 if buff started with a '!'
>   *     0 otherwise.
>   */

@len above needs to be updated for kernel doc. The description should
also note what *len gets set to at the end.

> -enum regex_type filter_parse_regex(char *buff, int len, char **search, int *not)
> +enum regex_type filter_parse_regex(char *buff, int *len, char **search, int *not)
>  {
>  	int type = MATCH_FULL;
>  	int i;
> @@ -329,13 +329,13 @@ enum regex_type filter_parse_regex(char *buff, int len, char **search, int *not)
>  	if (buff[0] == '!') {
>  		*not = 1;
>  		buff++;
> -		len--;
> +		(*len)--;
>  	} else
>  		*not = 0;
>  
>  	*search = buff;
>  
> -	for (i = 0; i < len; i++) {
> +	for (i = 0; i < *len; i++) {
>  		if (buff[i] == '*') {
>  			if (!i) {
>  				*search = buff + 1;
> @@ -350,6 +350,7 @@ enum regex_type filter_parse_regex(char *buff, int len, char **search, int *not)
>  			}
>  		}
>  	}
> +	*len = strlen(*search);

We could optimize this even further:

	*len = &buff[i] - *search;

-- Steve

>  
>  	return type;
>  }
--
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