Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: mtu3: tracing: Use the new __vstring() helper

Instead of open coding a __dynamic_array() with a fixed length (which
defeats the purpose of the dynamic array in the first place). Use the new
__vstring() helper that will use a va_list and only write enough of the
string into the ring buffer that is needed.

Link: https://lkml.kernel.org/r/20220719112719.17e796c6@gandalf.local.home

Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-usb@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

+2 -4
+2 -4
drivers/usb/mtu3/mtu3_trace.h
··· 18 18 19 19 #include "mtu3.h" 20 20 21 - #define MTU3_MSG_MAX 256 22 - 23 21 TRACE_EVENT(mtu3_log, 24 22 TP_PROTO(struct device *dev, struct va_format *vaf), 25 23 TP_ARGS(dev, vaf), 26 24 TP_STRUCT__entry( 27 25 __string(name, dev_name(dev)) 28 - __dynamic_array(char, msg, MTU3_MSG_MAX) 26 + __vstring(msg, vaf->fmt, vaf->va) 29 27 ), 30 28 TP_fast_assign( 31 29 __assign_str(name, dev_name(dev)); 32 - vsnprintf(__get_str(msg), MTU3_MSG_MAX, vaf->fmt, *vaf->va); 30 + __assign_vstr(msg, vaf->fmt, vaf->va); 33 31 ), 34 32 TP_printk("%s: %s", __get_str(name), __get_str(msg)) 35 33 );