Pull tracing fixes from Steven Rostedt: - Check for NULL in kretprobe_dispatcher() NULL can now be passed in, make sure it can handle it - Clean up unneeded #endif #ifdef of the same preprocessor check in the middle of the block. - Comment clean up - Remove unneeded initialization of the "ret" variable in __trace_uprobe_create() * tag 'trace-v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing/uprobes: Remove unwanted initialization in __trace_uprobe_create() tracefs: Fix syntax errors in comments tracing: Simplify conditional compilation code in tracing_set_tracer() tracing/kprobes: Check whether get_kretprobe() returns NULL in kretprobe_dispatcher()
Unified · Split
| @@ -553,7 +553,7 @@ struct dentry *tracefs_create_dir(const char *name, struct dentry *parent) · 552 unmodified lines | |||
| 553 | * | 553 | * |
| 554 | * Only one instances directory is allowed. | 554 | * Only one instances directory is allowed. |
| 555 | * | 555 | * |
| 556 | * The instances directory is special as it allows for mkdir and rmdir to | 556 | * The instances directory is special as it allows for mkdir and rmdir |
| 557 | * to be done by userspace. When a mkdir or rmdir is performed, the inode | 557 | * to be done by userspace. When a mkdir or rmdir is performed, the inode |
| 558 | * locks are released and the methods passed in (@mkdir and @rmdir) are | 558 | * locks are released and the methods passed in (@mkdir and @rmdir) are |
| 559 | * called without locks and with the name of the directory being created | 559 | * called without locks and with the name of the directory being created |
| @@ -6424,9 +6424,7 @@ int tracing_set_tracer(struct trace_array *tr, const char *buf) · 6423 unmodified lines | |||
| 6424 | synchronize_rcu(); | 6424 | synchronize_rcu(); |
| 6425 | free_snapshot(tr); | 6425 | free_snapshot(tr); |
| 6426 | } | 6426 | } |
| 6427 | #endif | ||
| 6428 | 6427 | ||
| 6429 | #ifdef CONFIG_TRACER_MAX_TRACE | ||
| 6430 | if (t->use_max_tr && !had_max_tr) { | 6428 | if (t->use_max_tr && !had_max_tr) { |
| 6431 | ret = tracing_alloc_snapshot_instance(tr); | 6429 | ret = tracing_alloc_snapshot_instance(tr); |
| 6432 | if (ret < 0) | 6430 | if (ret < 0) |
| @@ -1718,8 +1718,17 @@ static int · 1717 unmodified lines | |||
| 1718 | kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) | 1718 | kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) |
| 1719 | { | 1719 | { |
| 1720 | struct kretprobe *rp = get_kretprobe(ri); | 1720 | struct kretprobe *rp = get_kretprobe(ri); |
| 1721 | struct trace_kprobe *tk = container_of(rp, struct trace_kprobe, rp); | 1721 | struct trace_kprobe *tk; |
| 1722 | |||
| 1723 | /* | ||
| 1724 | * There is a small chance that get_kretprobe(ri) returns NULL when | ||
| 1725 | * the kretprobe is unregister on another CPU between kretprobe's | ||
| 1726 | * trampoline_handler and this function. | ||
| 1727 | */ | ||
| 1728 | if (unlikely(!rp)) | ||
| 1729 | return 0; | ||
| 1722 | 1730 | ||
| 1731 | tk = container_of(rp, struct trace_kprobe, rp); | ||
| 1723 | raw_cpu_inc(*tk->nhit); | 1732 | raw_cpu_inc(*tk->nhit); |
| 1724 | 1733 | ||
| 1725 | if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) | 1734 | if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) |
| @@ -546,7 +546,6 @@ static int __trace_uprobe_create(int argc, const char **argv) · 545 unmodified lines | |||
| 546 | bool is_return = false; | 546 | bool is_return = false; |
| 547 | int i, ret; | 547 | int i, ret; |
| 548 | 548 | ||
| 549 | ret = 0; | ||
| 550 | ref_ctr_offset = 0; | 549 | ref_ctr_offset = 0; |
| 551 | 550 | ||
| 552 | switch (argv[0][0]) { | 551 | switch (argv[0][0]) { |