diff options
-rw-r--r-- | kernel/trace/ring_buffer.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 30d57dd01a85..d42b882dfe4b 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -117,7 +117,13 @@ rb_event_length(struct ring_buffer_event *event) | |||
117 | */ | 117 | */ |
118 | unsigned ring_buffer_event_length(struct ring_buffer_event *event) | 118 | unsigned ring_buffer_event_length(struct ring_buffer_event *event) |
119 | { | 119 | { |
120 | return rb_event_length(event); | 120 | unsigned length = rb_event_length(event); |
121 | if (event->type != RINGBUF_TYPE_DATA) | ||
122 | return length; | ||
123 | length -= RB_EVNT_HDR_SIZE; | ||
124 | if (length > RB_MAX_SMALL_DATA + sizeof(event->array[0])) | ||
125 | length -= sizeof(event->array[0]); | ||
126 | return length; | ||
121 | } | 127 | } |
122 | EXPORT_SYMBOL_GPL(ring_buffer_event_length); | 128 | EXPORT_SYMBOL_GPL(ring_buffer_event_length); |
123 | 129 | ||