This is a note to let you know that I've just added the patch titled tracing: Have the historgram use the result of str_has_prefix() for len of prefix to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: tracing-have-the-historgram-use-the-result-of-str_has_prefix-for-len-of-prefix.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From stable+bounces-43486-greg=kroah.com@xxxxxxxxxxxxxxx Thu May 9 04:30:45 2024 From: George Guo <dongtai.guo@xxxxxxxxx> Date: Thu, 9 May 2024 10:29:27 +0800 Subject: tracing: Have the historgram use the result of str_has_prefix() for len of prefix To: gregkh@xxxxxxxxxxxxxxxxxxx, rostedt@xxxxxxxxxxx, mhiramat@xxxxxxxxxx, tom.zanussi@xxxxxxxxxxxxxxx Cc: stable@xxxxxxxxxxxxxxx, Tom Zanussi <zanussi@xxxxxxxxxx>, Namhyung Kim <namhyung@xxxxxxxxxx>, George Guo <guodongtai@xxxxxxxxxx> Message-ID: <20240509022931.3513365-10-dongtai.guo@xxxxxxxxx> From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx> commit 036876fa56204ae0fa59045bd6bbb2691a060633 upstream. As str_has_prefix() returns the length on match, we can use that for the updating of the string pointer instead of recalculating the prefix size. Cc: Tom Zanussi <zanussi@xxxxxxxxxx> Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx> Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> Signed-off-by: George Guo <guodongtai@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- kernel/trace/trace_events_hist.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -4410,12 +4410,13 @@ static int parse_actions(struct hist_tri unsigned int i; int ret = 0; char *str; + int len; for (i = 0; i < hist_data->attrs->n_actions; i++) { str = hist_data->attrs->action_str[i]; - if (str_has_prefix(str, "onmatch(")) { - char *action_str = str + sizeof("onmatch(") - 1; + if ((len = str_has_prefix(str, "onmatch("))) { + char *action_str = str + len; data = onmatch_parse(tr, action_str); if (IS_ERR(data)) { @@ -4423,8 +4424,8 @@ static int parse_actions(struct hist_tri break; } data->fn = action_trace; - } else if (str_has_prefix(str, "onmax(")) { - char *action_str = str + sizeof("onmax(") - 1; + } else if ((len = str_has_prefix(str, "onmax("))) { + char *action_str = str + len; data = onmax_parse(action_str); if (IS_ERR(data)) { Patches currently in stable-queue which might be from kroah.com@xxxxxxxxxxxxxxx are queue-4.19/tracing-consolidate-trace_add-remove_event_call-back-to-the-nolock-functions.patch queue-4.19/tracing-split-up-onmatch-action-data.patch queue-4.19/tracing-remove-unnecessary-var_ref-destroy-in-track_data_destroy.patch queue-4.19/tracing-use-str_has_prefix-helper-for-histogram-code.patch queue-4.19/tracing-simplify-creation-and-deletion-of-synthetic-events.patch queue-4.19/tracing-refactor-hist-trigger-action-code.patch queue-4.19/string.h-add-str_has_prefix-helper-function.patch queue-4.19/tracing-remove-unneeded-synth_event_mutex.patch queue-4.19/tracing-add-unified-dynamic-event-framework.patch queue-4.19/tracing-use-dyn_event-framework-for-synthetic-events.patch queue-4.19/tracing-use-str_has_prefix-instead-of-using-fixed-sizes.patch queue-4.19/tracing-generalize-hist-trigger-onmax-and-save-action.patch queue-4.19/tracing-have-the-historgram-use-the-result-of-str_has_prefix-for-len-of-prefix.patch