aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2010-01-13 21:54:27 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-01-14 22:38:12 -0500
commit16da27a8bc7a0d050686d1b2e9efb53fab9ed226 (patch)
treedef65eba395d9b2a2531f87dc1dd051be7845e92 /kernel
parentb2af211f284eb1bef19fbb85fc8ef551bb1e7460 (diff)
tracing/filters: Fix MATCH_FULL filter matching for PTR_STRING
MATCH_FULL matching for PTR_STRING 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() We should pass to regex.match(..., len) the length (including '\0') of the source string instead of the length of the pattern string. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> LKML-Reference: <4B4E8763.5070707@cn.fujitsu.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_events_filter.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index f364b085397..60c2a4efad4 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -211,8 +211,9 @@ static int filter_pred_pchar(struct filter_pred *pred, void *event,
211{ 211{
212 char **addr = (char **)(event + pred->offset); 212 char **addr = (char **)(event + pred->offset);
213 int cmp, match; 213 int cmp, match;
214 int len = strlen(*addr) + 1; /* including tailing '\0' */
214 215
215 cmp = pred->regex.match(*addr, &pred->regex, pred->regex.field_len); 216 cmp = pred->regex.match(*addr, &pred->regex, len);
216 217
217 match = cmp ^ pred->not; 218 match = cmp ^ pred->not;
218 219
@@ -782,10 +783,8 @@ static int filter_add_pred(struct filter_parse_state *ps,
782 pred->regex.field_len = field->size; 783 pred->regex.field_len = field->size;
783 } else if (field->filter_type == FILTER_DYN_STRING) 784 } else if (field->filter_type == FILTER_DYN_STRING)
784 fn = filter_pred_strloc; 785 fn = filter_pred_strloc;
785 else { 786 else
786 fn = filter_pred_pchar; 787 fn = filter_pred_pchar;
787 pred->regex.field_len = strlen(pred->regex.pattern);
788 }
789 } else { 788 } else {
790 if (field->is_signed) 789 if (field->is_signed)
791 ret = strict_strtoll(pred->regex.pattern, 0, &val); 790 ret = strict_strtoll(pred->regex.pattern, 0, &val);