Skip to content

Commit a2c48d9

Browse files
committed
Merge tag 'trace-v5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fixes from Steven Rostedt: "Tom Zanussi sent me some small fixes and cleanups to the histogram code and I forgot to incorporate them. I also added a small clean up patch that was sent to me a while ago and I just noticed it" * tag 'trace-v5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: kernel/trace/trace.h: Remove duplicate header of trace_seq.h tracing: Add a check_val() check before updating cond_snapshot() track_val tracing: Check keys for variable references in expressions too tracing: Prevent hist_field_var_ref() from accessing NULL tracing_map_elts
2 parents 2409207 + 4eebe38 commit a2c48d9

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

kernel/trace/trace.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <linux/trace_seq.h>
1616
#include <linux/trace_events.h>
1717
#include <linux/compiler.h>
18-
#include <linux/trace_seq.h>
1918
#include <linux/glob.h>
2019

2120
#ifdef CONFIG_FTRACE_SYSCALLS

kernel/trace/trace_events_hist.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
C(NO_CLOSING_PAREN, "No closing paren found"), \
6060
C(SUBSYS_NOT_FOUND, "Missing subsystem"), \
6161
C(INVALID_SUBSYS_EVENT, "Invalid subsystem or event name"), \
62-
C(INVALID_REF_KEY, "Using variable references as keys not supported"), \
62+
C(INVALID_REF_KEY, "Using variable references in keys not supported"), \
6363
C(VAR_NOT_FOUND, "Couldn't find variable"), \
6464
C(FIELD_NOT_FOUND, "Couldn't find field"),
6565

@@ -1854,6 +1854,9 @@ static u64 hist_field_var_ref(struct hist_field *hist_field,
18541854
struct hist_elt_data *elt_data;
18551855
u64 var_val = 0;
18561856

1857+
if (WARN_ON_ONCE(!elt))
1858+
return var_val;
1859+
18571860
elt_data = elt->private_data;
18581861
var_val = elt_data->var_ref_vals[hist_field->var_ref_idx];
18591862

@@ -3582,14 +3585,20 @@ static bool cond_snapshot_update(struct trace_array *tr, void *cond_data)
35823585
struct track_data *track_data = tr->cond_snapshot->cond_data;
35833586
struct hist_elt_data *elt_data, *track_elt_data;
35843587
struct snapshot_context *context = cond_data;
3588+
struct action_data *action;
35853589
u64 track_val;
35863590

35873591
if (!track_data)
35883592
return false;
35893593

3594+
action = track_data->action_data;
3595+
35903596
track_val = get_track_val(track_data->hist_data, context->elt,
35913597
track_data->action_data);
35923598

3599+
if (!action->track_data.check_val(track_data->track_val, track_val))
3600+
return false;
3601+
35933602
track_data->track_val = track_val;
35943603
memcpy(track_data->key, context->key, track_data->key_len);
35953604

@@ -4503,7 +4512,7 @@ static int create_key_field(struct hist_trigger_data *hist_data,
45034512
goto out;
45044513
}
45054514

4506-
if (hist_field->flags & HIST_FIELD_FL_VAR_REF) {
4515+
if (field_has_hist_vars(hist_field, 0)) {
45074516
hist_err(tr, HIST_ERR_INVALID_REF_KEY, errpos(field_str));
45084517
destroy_hist_field(hist_field, 0);
45094518
ret = -EINVAL;

0 commit comments

Comments
 (0)