mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-14 06:35:12 +00:00
kprobes/tracing: Use trace_seq_has_overflowed() for overflow checks
Instead of checking the return value of trace_seq_printf() and friends for overflowing of the buffer, use the trace_seq_has_overflowed() helper function. This cleans up the code quite a bit and also takes us a step closer to changing the return values of trace_seq_printf() and friends to void. Link: http://lkml.kernel.org/r/20141114011411.181812785@goodmis.org Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Reviewed-by: Petr Mladek <pmladek@suse.cz> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
parent
9d9add34ec
commit
85224da0b8
1 changed files with 16 additions and 26 deletions
|
@ -1024,27 +1024,22 @@ print_kprobe_event(struct trace_iterator *iter, int flags,
|
||||||
field = (struct kprobe_trace_entry_head *)iter->ent;
|
field = (struct kprobe_trace_entry_head *)iter->ent;
|
||||||
tp = container_of(event, struct trace_probe, call.event);
|
tp = container_of(event, struct trace_probe, call.event);
|
||||||
|
|
||||||
if (!trace_seq_printf(s, "%s: (", ftrace_event_name(&tp->call)))
|
trace_seq_printf(s, "%s: (", ftrace_event_name(&tp->call));
|
||||||
goto partial;
|
|
||||||
|
|
||||||
if (!seq_print_ip_sym(s, field->ip, flags | TRACE_ITER_SYM_OFFSET))
|
if (!seq_print_ip_sym(s, field->ip, flags | TRACE_ITER_SYM_OFFSET))
|
||||||
goto partial;
|
goto out;
|
||||||
|
|
||||||
if (!trace_seq_putc(s, ')'))
|
trace_seq_putc(s, ')');
|
||||||
goto partial;
|
|
||||||
|
|
||||||
data = (u8 *)&field[1];
|
data = (u8 *)&field[1];
|
||||||
for (i = 0; i < tp->nr_args; i++)
|
for (i = 0; i < tp->nr_args; i++)
|
||||||
if (!tp->args[i].type->print(s, tp->args[i].name,
|
if (!tp->args[i].type->print(s, tp->args[i].name,
|
||||||
data + tp->args[i].offset, field))
|
data + tp->args[i].offset, field))
|
||||||
goto partial;
|
goto out;
|
||||||
|
|
||||||
if (!trace_seq_putc(s, '\n'))
|
trace_seq_putc(s, '\n');
|
||||||
goto partial;
|
out:
|
||||||
|
return trace_handle_return(s);
|
||||||
return TRACE_TYPE_HANDLED;
|
|
||||||
partial:
|
|
||||||
return TRACE_TYPE_PARTIAL_LINE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum print_line_t
|
static enum print_line_t
|
||||||
|
@ -1060,33 +1055,28 @@ print_kretprobe_event(struct trace_iterator *iter, int flags,
|
||||||
field = (struct kretprobe_trace_entry_head *)iter->ent;
|
field = (struct kretprobe_trace_entry_head *)iter->ent;
|
||||||
tp = container_of(event, struct trace_probe, call.event);
|
tp = container_of(event, struct trace_probe, call.event);
|
||||||
|
|
||||||
if (!trace_seq_printf(s, "%s: (", ftrace_event_name(&tp->call)))
|
trace_seq_printf(s, "%s: (", ftrace_event_name(&tp->call));
|
||||||
goto partial;
|
|
||||||
|
|
||||||
if (!seq_print_ip_sym(s, field->ret_ip, flags | TRACE_ITER_SYM_OFFSET))
|
if (!seq_print_ip_sym(s, field->ret_ip, flags | TRACE_ITER_SYM_OFFSET))
|
||||||
goto partial;
|
goto out;
|
||||||
|
|
||||||
if (!trace_seq_puts(s, " <- "))
|
trace_seq_puts(s, " <- ");
|
||||||
goto partial;
|
|
||||||
|
|
||||||
if (!seq_print_ip_sym(s, field->func, flags & ~TRACE_ITER_SYM_OFFSET))
|
if (!seq_print_ip_sym(s, field->func, flags & ~TRACE_ITER_SYM_OFFSET))
|
||||||
goto partial;
|
goto out;
|
||||||
|
|
||||||
if (!trace_seq_putc(s, ')'))
|
trace_seq_putc(s, ')');
|
||||||
goto partial;
|
|
||||||
|
|
||||||
data = (u8 *)&field[1];
|
data = (u8 *)&field[1];
|
||||||
for (i = 0; i < tp->nr_args; i++)
|
for (i = 0; i < tp->nr_args; i++)
|
||||||
if (!tp->args[i].type->print(s, tp->args[i].name,
|
if (!tp->args[i].type->print(s, tp->args[i].name,
|
||||||
data + tp->args[i].offset, field))
|
data + tp->args[i].offset, field))
|
||||||
goto partial;
|
goto out;
|
||||||
|
|
||||||
if (!trace_seq_putc(s, '\n'))
|
trace_seq_putc(s, '\n');
|
||||||
goto partial;
|
|
||||||
|
|
||||||
return TRACE_TYPE_HANDLED;
|
out:
|
||||||
partial:
|
return trace_handle_return(s);
|
||||||
return TRACE_TYPE_PARTIAL_LINE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue