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: <20150206135519.7ce422eb@gandalf.local.home>
Date:	Fri, 6 Feb 2015 13:55:19 -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 v2 5/7] trace: make filter_parse_regex() provide
 the length of substring to compare with

On Fri,  6 Feb 2015 04:00:13 +0000
Al Viro <viro@...IV.linux.org.uk> wrote:


> --- 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.
>   */

Still needs the update to kernel doc.

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

This should just add what the next patch does, instead of adding the
strlen() then changing it again. The change works here as well.

-	*len = strlen(*search);
+	*len = buff + i - *search;

It makes more sense to just add it here instead of having it changed
again.

-- Steve


>  
>  	return type;
>  }
> @@ -362,8 +363,7 @@ static void filter_build_regex(struct filter_pred *pred)
>  	int not = 0;
>  
>  	if (pred->op == OP_GLOB) {
> -		type = filter_parse_regex(r->pattern, r->len, &search, &not);
> -		r->len = strlen(search);
> +		type = filter_parse_regex(r->pattern, &r->len, &search, &not);
>  		memmove(r->pattern, search, r->len+1);
>  	}
>  

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