diff options
author | Tom Zanussi <zanussi@kernel.org> | 2022-01-26 16:29:22 -0600 |
---|---|---|
committer | Tom Zanussi <zanussi@kernel.org> | 2022-01-27 15:38:28 -0600 |
commit | a291c672d6e1d7f557d9e15a5ac3f0b446e29dcd (patch) | |
tree | da1ed5212854529ab0265527e08b27e30b1974b3 | |
parent | b519e15e681319e99055a92c8d090072ebb2b179 (diff) | |
download | linux-trace-ftrace/misc-bugfixes-v1.tar.gz |
tracing: Remove size restriction on synthetic event cmd error loggingftrace/misc-bugfixes-v1
Currently, synthetic event command error strings are restricted to a
length of MAX_FILTER_STR_VAL (256), which is too short for some
commands already seen in the wild (with cmd strings longer than that
showing up truncated in err_log).
Remove the restriction so that no synthetic event command error string
is ever truncated.
Signed-off-by: Tom Zanussi <zanussi@kernel.org>
-rw-r--r-- | kernel/trace/trace_events_synth.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c index 149011e34ad9f..7d50b4251c60b 100644 --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -42,10 +42,13 @@ enum { ERRORS }; static const char *err_text[] = { ERRORS }; -static char last_cmd[MAX_FILTER_STR_VAL]; +static char *last_cmd; static int errpos(const char *str) { + if (!str || !last_cmd) + return 0; + return err_pos(last_cmd, str); } @@ -54,11 +57,19 @@ static void last_cmd_set(const char *str) if (!str) return; - strncpy(last_cmd, str, MAX_FILTER_STR_VAL - 1); + kfree(last_cmd); + last_cmd = kzalloc(strlen(str) + 1, GFP_KERNEL); + if (!last_cmd) + return; + + strncpy(last_cmd, str, strlen(str)); } -static void synth_err(u8 err_type, u8 err_pos) +static void synth_err(u8 err_type, u16 err_pos) { + if (!last_cmd) + return; + tracing_log_err(NULL, "synthetic_events", last_cmd, err_text, err_type, err_pos); } |