[PATCH 09/11] tracing: check full name for field

From: Steven Rostedt
Date: Wed Jun 10 2009 - 01:45:03 EST


From: Steven Rostedt <srostedt@xxxxxxxxxx>

The check for print format fields only compared the name of the field
up to the length of the field to look for. But it did not test if the
field name itself matched but was larger. The wrong field could be
found as a match.

ie. str could match str_arr.

[ Impact: fix the matching of fields ]

Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
kernel/trace/trace_read_binary.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/trace_read_binary.c b/kernel/trace/trace_read_binary.c
index 9ff4ed8..779de20 100644
--- a/kernel/trace/trace_read_binary.c
+++ b/kernel/trace/trace_read_binary.c
@@ -388,7 +388,8 @@ find_field(struct ftrace_event_call *call, const char *name, int len)
struct ftrace_event_field *field;

list_for_each_entry(field, &call->fields, link) {
- if (!strncmp(field->name, name, len))
+ if (!strncmp(field->name, name, len) &&
+ !field->name[len])
return field;
}

--
1.6.3.1

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/