linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@akamai.com>
To: Joe Perches <joe@perches.com>
Cc: "Du, Changbin" <changbin.du@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dynamic_debug: add wildcard support to filter files/functions/modules
Date: Mon, 29 Jul 2013 23:59:19 -0400	[thread overview]
Message-ID: <51F73A17.2090208@akamai.com> (raw)
In-Reply-To: <1374770840.1957.4.camel@joe-AO722>

On 07/25/2013 12:47 PM, Joe Perches wrote:
> On Thu, 2013-07-25 at 21:02 +0800, Du, Changbin wrote:
>> From: "Du, Changbin" <changbin.du@gmail.com>
>>
>> This patch add wildcard '*'(matches zero or more characters) and '?'
>> (matches one character) support when qurying debug flags.
> Seems very useful.  Caveat below.
>
>> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> []
>> @@ -127,6 +127,21 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg)
>>   		 query->first_lineno, query->last_lineno);
>>   }
>>   
>> +static int match_pattern(char *pat, char *str)
>> +{
>> +	switch (*pat) {
>> +	case '\0':
>> +		return !*str;
>> +	case '*':
>> +		return  match_pattern(pat+1, str) ||
>> +			(*str && match_pattern(pat, str+1));
>> +	case '?':
>> +		return *str && match_pattern(pat+1, str+1);
>> +	default:
>> +		return *pat == *str && match_pattern(pat+1, str 1);
>> +	}
>> +}
> What's the maximum length string used today?
> On a very long pattern, can this recursion cause stack overflow?
>
> Other than that, I like it.

The recursion here is a concern - especially since the 'pat' pointer is 
controlled from userspace. Maybe not at pretty, but this can easily be 
done in userspace. For example, to set all driver/usb* one could do 
something like:

grep "drivers/usb" control | awk -F ":| "  '{ print "file " $1 " line " 
$2 }' | xargs -i -n1 echo {} +p > control

Thanks,

-Jason




  reply	other threads:[~2013-07-30  3:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-25 13:02 [PATCH] dynamic_debug: add wildcard support to filter files/functions/modules Du, Changbin
2013-07-25 16:47 ` Joe Perches
2013-07-30  3:59   ` Jason Baron [this message]
2013-10-28 15:29     ` [PATCH v2] " Du, Changbin
2013-10-28 16:30       ` Joe Perches
2013-10-29  8:04         ` Changbin Du
2013-10-29 13:33           ` [PATCH v3] " Du, Changbin
2013-10-29 16:20             ` Joe Perches
2013-10-30  6:58               ` Changbin Du
2013-10-30 13:57                 ` Changbin Du
2013-10-30 14:21                   ` [PATCH v4 1/2] " Du, Changbin
2013-10-30 14:21                   ` [PATCH v4 2/2] dynamic-debug-howto.txt: update since new wildcard support Du, Changbin
2013-10-29 20:21             ` [PATCH v3] dynamic_debug: add wildcard support to filter files/functions/modules Marcel Holtmann
2013-10-30  6:24               ` Changbin Du
2013-10-31 22:52       ` [PATCH v2] " Andrew Morton
2013-10-31 23:30         ` Joe Perches
2013-11-07  3:04           ` Changbin Du
2013-11-07  3:11           ` Changbin Du
2013-11-07  6:12             ` Joe Perches
2013-11-15  4:01               ` Changbin Du
2013-11-16  8:24                 ` [PATCH v5 0/3] add wildcard support for dynamic debug Du, Changbin
2013-11-16  8:24                 ` [PATCH v5 1/3] lib/parser.c: add match_wildcard function Du, Changbin
2013-11-16  8:24                 ` [PATCH v5 2/3] dynamic_debug: add wildcard support to filter files/functions/modules Du, Changbin
2013-11-16  8:24                 ` [PATCH v5 3/3] dynamic-debug-howto.txt: update since new wildcard support Du, Changbin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51F73A17.2090208@akamai.com \
    --to=jbaron@akamai.com \
    --cc=changbin.du@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).