From: Li Zefan <lizf@cn.fujitsu.com>
To: Wenji Huang <wenji.huang@oracle.com>
Cc: linux-kernel@vger.kernel.org, rostedt@goodmis.org,
fweisbec@gmail.com, tzanussi@gmail.com
Subject: Re: [PATCH]tracing: Fix inaccurate function definition in trace_events_filter.c
Date: Fri, 11 Dec 2009 16:15:00 +0800 [thread overview]
Message-ID: <4B21FF84.3010509@cn.fujitsu.com> (raw)
In-Reply-To: <1260518338-16034-1-git-send-email-wenji.huang@oracle.com>
Wenji Huang wrote:
> Use strcmp instead of strncmp to do full match.
>
It's intended to use strncmp instead of strcmp..
field(char, name, size) will be treated as a STATIC_STRING by
filter code. But this field isn't necessarily a string, it
can be an array of chars, which may not be ended with '\0'.
So in this case, we can't use strcmp.
So do you really see incorrect filter results?
I think STATIC_STRING and DYN_STRING should be fine, because
the "len" parameter is not the length of the string, but
the length of the array, which including the tailing '\0'.
For FILTER_PTR_STRING, the filter is not working correctly:
# echo 'func == vt' > events/bkl/lock_kernel/filter
# echo 1 > events/bkl/lock_kernel/enable
...
# cat trace
Xorg-1484 [000] 1973.392586: lock_kernel: ... func=vt_ioctl()
gpm-1402 [001] 1974.027740: lock_kernel: ... func=vt_ioctl()
Actually I already made 2 patches to fix this, and fix another
bug in regex_match_end(). I'll send them out soon.
> Signed-off-by: Wenji Huang <wenji.huang@oracle.com>
> ---
> kernel/trace/trace_events_filter.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
> index 50504cb..06dc376 100644
> --- a/kernel/trace/trace_events_filter.c
> +++ b/kernel/trace/trace_events_filter.c
> @@ -254,7 +254,7 @@ static int filter_pred_none(struct filter_pred *pred, void *event,
> /* Basic regex callbacks */
> static int regex_match_full(char *str, struct regex *r, int len)
> {
> - if (strncmp(str, r->pattern, len) == 0)
> + if (strcmp(str, r->pattern) == 0)
> return 1;
> return 0;
> }
next prev parent reply other threads:[~2009-12-11 8:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-11 7:58 [PATCH]tracing: Fix inaccurate function definition in trace_events_filter.c Wenji Huang
2009-12-11 8:15 ` Li Zefan [this message]
2009-12-11 14:39 ` Steven Rostedt
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=4B21FF84.3010509@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tzanussi@gmail.com \
--cc=wenji.huang@oracle.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.