diff options
-rw-r--r-- | include/linux/ftrace_event.h | 5 | ||||
-rw-r--r-- | kernel/trace/trace_events.c | 2 | ||||
-rw-r--r-- | kernel/trace/trace_output.c | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 2a4a40749911..07e0a6d64a24 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -16,13 +16,16 @@ struct dentry; | |||
16 | * bash-15816 [01] 235.197585: idle_cpu <- irq_enter | 16 | * bash-15816 [01] 235.197585: idle_cpu <- irq_enter |
17 | */ | 17 | */ |
18 | struct trace_entry { | 18 | struct trace_entry { |
19 | int type; | 19 | unsigned short type; |
20 | unsigned char flags; | 20 | unsigned char flags; |
21 | unsigned char preempt_count; | 21 | unsigned char preempt_count; |
22 | int pid; | 22 | int pid; |
23 | int tgid; | 23 | int tgid; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | #define FTRACE_MAX_EVENT \ | ||
27 | ((1 << (sizeof(((struct trace_entry *)0)->type) * 8)) - 1) | ||
28 | |||
26 | /* | 29 | /* |
27 | * Trace iterator - used by printout routines who present trace | 30 | * Trace iterator - used by printout routines who present trace |
28 | * results to users and which routines might sleep, etc: | 31 | * results to users and which routines might sleep, etc: |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 5d6e879cf875..9887131afa03 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -398,7 +398,7 @@ static int trace_write_header(struct trace_seq *s) | |||
398 | "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" | 398 | "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" |
399 | "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" | 399 | "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" |
400 | "\n", | 400 | "\n", |
401 | FIELD(int, type), | 401 | FIELD(unsigned short, type), |
402 | FIELD(unsigned char, flags), | 402 | FIELD(unsigned char, flags), |
403 | FIELD(unsigned char, preempt_count), | 403 | FIELD(unsigned char, preempt_count), |
404 | FIELD(int, pid), | 404 | FIELD(int, pid), |
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 83a8abb9640f..06997e75114b 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -537,6 +537,8 @@ int register_ftrace_event(struct trace_event *event) | |||
537 | out: | 537 | out: |
538 | mutex_unlock(&trace_event_mutex); | 538 | mutex_unlock(&trace_event_mutex); |
539 | 539 | ||
540 | WARN_ON_ONCE(next_event_type > FTRACE_MAX_EVENT); | ||
541 | |||
540 | return ret; | 542 | return ret; |
541 | } | 543 | } |
542 | EXPORT_SYMBOL_GPL(register_ftrace_event); | 544 | EXPORT_SYMBOL_GPL(register_ftrace_event); |