Thread (9 messages) 9 messages, 4 authors, 2024-03-14

Re: [FYI][PATCH] tracing/treewide: Remove second parameter of __assign_str()

From: Steven Rostedt <rostedt@goodmis.org>
Date: 2024-02-23 20:43:45
Also in: amd-gfx, ath11k, ath12k, bpf, dri-devel, intel-gfx, intel-xe, io-uring, kvm, linux-arm-msm, linux-bcachefs, linux-block, linux-btrfs, linux-cifs, linux-cxl, linux-edac, linux-f2fs-devel, linux-hwmon, linux-hyperv, linux-iommu, linux-media, linux-nfs, linux-pm, linux-rdma, linux-s390, linux-sound, linux-tegra, linux-trace-kernel, linux-usb, linux-wireless, linux-xfs, linuxppc-dev, lkml, ocfs2-devel, selinux, virtualization
Subsystem: the rest, tracing · Maintainers: Linus Torvalds, Steven Rostedt, Masami Hiramatsu

On Fri, 23 Feb 2024 13:46:53 -0500
Steven Rostedt [off-list ref] wrote:
Now one thing I could do is to not remove the parameter, but just add:

	WARN_ON_ONCE((src) != __data_offsets->item##_ptr_);

in the __assign_str() macro to make sure that it's still the same that is
assigned. But I'm not sure how useful that is, and still causes burden to
have it. I never really liked the passing of the string in two places to
begin with.
Hmm, maybe I'll just add this patch for 6.9 and then in 6.10 do the
parameter removal.

-- Steve
diff --git a/include/trace/stages/stage6_event_callback.h b/include/trace/stages/stage6_event_callback.h
index 0c0f50bcdc56..7372e2c2a0c4 100644
--- a/include/trace/stages/stage6_event_callback.h
+++ b/include/trace/stages/stage6_event_callback.h
@@ -35,6 +35,7 @@ #define __assign_str(dst, src)
 	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';				\
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help