]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
tracing: Add warning if string in __assign_str() does not match __string()
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Fri, 23 Feb 2024 21:13:56 +0000 (16:13 -0500)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Mon, 18 Mar 2024 14:33:05 +0000 (10:33 -0400)
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().

Link: https://lore.kernel.org/linux-trace-kernel/20240223161356.63b72403@gandalf.local.home
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
include/trace/stages/stage6_event_callback.h

index 0c0f50bcdc56e886eb17d29cec46b5042988e67b..9356089718997b19e8b389ac95efdaac313d73e6 100644 (file)
@@ -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';                                \