* [PATCH v2] tracing: Add warning if string in __assign_str() does not match __string()
@ 2024-02-23 21:13 Steven Rostedt
2024-02-26 0:33 ` Masami Hiramatsu
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2024-02-23 21:13 UTC (permalink / raw)
To: LKML, Linux Trace Kernel; +Cc: Masami Hiramatsu, Mathieu Desnoyers
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
In preparation to remove the second parameter of __assign_str(), make sure
it is really a duplicate of __string() by adding a WARN_ON_ONCE().
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
Changes since v1: https://lore.kernel.org/linux-trace-kernel/20240223154821.77b2426d@gandalf.local.home/
- If src is NULL it is saved as NULL, no need to not test that too.
include/trace/stages/stage6_event_callback.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/trace/stages/stage6_event_callback.h b/include/trace/stages/stage6_event_callback.h
index 0c0f50bcdc56..935608971899 100644
--- a/include/trace/stages/stage6_event_callback.h
+++ b/include/trace/stages/stage6_event_callback.h
@@ -35,6 +35,7 @@
do { \
char *__str__ = __get_str(dst); \
int __len__ = __get_dynamic_array_len(dst) - 1; \
+ WARN_ON_ONCE((src) != __data_offsets.dst##_ptr_); \
memcpy(__str__, __data_offsets.dst##_ptr_ ? : \
EVENT_NULL_STR, __len__); \
__str__[__len__] = '\0'; \
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] tracing: Add warning if string in __assign_str() does not match __string()
2024-02-23 21:13 [PATCH v2] tracing: Add warning if string in __assign_str() does not match __string() Steven Rostedt
@ 2024-02-26 0:33 ` Masami Hiramatsu
2024-02-26 16:57 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Masami Hiramatsu @ 2024-02-26 0:33 UTC (permalink / raw)
To: Steven Rostedt
Cc: LKML, Linux Trace Kernel, Masami Hiramatsu, Mathieu Desnoyers
On Fri, 23 Feb 2024 16:13:56 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
>
> In preparation to remove the second parameter of __assign_str(), make sure
> it is really a duplicate of __string() by adding a WARN_ON_ONCE().
>
Looks good to me. So eventually this is removed when the second parameter
is removed?
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thank you,
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> Changes since v1: https://lore.kernel.org/linux-trace-kernel/20240223154821.77b2426d@gandalf.local.home/
>
> - If src is NULL it is saved as NULL, no need to not test that too.
>
> include/trace/stages/stage6_event_callback.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/trace/stages/stage6_event_callback.h b/include/trace/stages/stage6_event_callback.h
> index 0c0f50bcdc56..935608971899 100644
> --- a/include/trace/stages/stage6_event_callback.h
> +++ b/include/trace/stages/stage6_event_callback.h
> @@ -35,6 +35,7 @@
> do { \
> char *__str__ = __get_str(dst); \
> int __len__ = __get_dynamic_array_len(dst) - 1; \
> + WARN_ON_ONCE((src) != __data_offsets.dst##_ptr_); \
> memcpy(__str__, __data_offsets.dst##_ptr_ ? : \
> EVENT_NULL_STR, __len__); \
> __str__[__len__] = '\0'; \
> --
> 2.43.0
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] tracing: Add warning if string in __assign_str() does not match __string()
2024-02-26 0:33 ` Masami Hiramatsu
@ 2024-02-26 16:57 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2024-02-26 16:57 UTC (permalink / raw)
To: Masami Hiramatsu (Google); +Cc: LKML, Linux Trace Kernel, Mathieu Desnoyers
On Mon, 26 Feb 2024 09:33:28 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> On Fri, 23 Feb 2024 16:13:56 -0500
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> >
> > In preparation to remove the second parameter of __assign_str(), make sure
> > it is really a duplicate of __string() by adding a WARN_ON_ONCE().
> >
>
> Looks good to me. So eventually this is removed when the second parameter
> is removed?
Yes, I applied this after my other patches.
>
> Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thanks!
-- Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-26 16:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 21:13 [PATCH v2] tracing: Add warning if string in __assign_str() does not match __string() Steven Rostedt
2024-02-26 0:33 ` Masami Hiramatsu
2024-02-26 16:57 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).