Skip to content

Commit

Permalink
tracing: Restore the const qualifier for field names and types defini…
Browse files Browse the repository at this point in the history
…tion

Restore the const qualifier in field's name and type parameters of
trace_define_field that was lost while solving a conflict.

Fields names and types are defined as builtin constant strings in
static TRACE_EVENTs. But kprobes allocates these dynamically.

That said, we still want to always pass these strings as const char *
in trace_define_fields() to avoid any further accidental writes on
the pointed strings.

Reported-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Frederic Weisbecker committed Aug 27, 2009
1 parent 24851d2 commit aeaeae1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions include/linux/ftrace_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ enum {
};

extern int trace_define_common_fields(struct ftrace_event_call *call);
extern int trace_define_field(struct ftrace_event_call *call, char *type,
char *name, int offset, int size, int is_signed,
int filter_type);
extern int trace_define_field(struct ftrace_event_call *call, const char *type,
const char *name, int offset, int size,
int is_signed, int filter_type);
extern int trace_add_event_call(struct ftrace_event_call *call);
extern void trace_remove_event_call(struct ftrace_event_call *call);

Expand Down
4 changes: 2 additions & 2 deletions kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ DEFINE_MUTEX(event_mutex);

LIST_HEAD(ftrace_events);

int trace_define_field(struct ftrace_event_call *call, char *type,
char *name, int offset, int size, int is_signed,
int trace_define_field(struct ftrace_event_call *call, const char *type,
const char *name, int offset, int size, int is_signed,
int filter_type)
{
struct ftrace_event_field *field;
Expand Down
4 changes: 2 additions & 2 deletions kernel/trace/trace_syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ int syscall_enter_define_fields(struct ftrace_event_call *call)
return ret;

for (i = 0; i < meta->nb_args; i++) {
ret = trace_define_field(call, (char *)meta->types[i],
(char *)meta->args[i], offset,
ret = trace_define_field(call, meta->types[i],
meta->args[i], offset,
sizeof(unsigned long), 0,
FILTER_OTHER);
offset += sizeof(unsigned long);
Expand Down

0 comments on commit aeaeae1

Please sign in to comment.