From patchwork Sun Jul 31 19:03:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 12933200 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F238C00140 for ; Sun, 31 Jul 2022 19:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:Subject:Cc:To: From:Date:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: List-Owner; bh=q4Pp2bLNMLRajzXCjgkDVXcariXuyapZvERDMLIkyCA=; b=o3vWr+1t64Yep3 SG3WO49Jo055qqPfVWScZ7FbK0c779iqw1RPupNIsZsv+1ycXDzj+kEmSqXZ4r+6M4SWwP64w9nVc lkd4xcJIXjd9d6i/i67k+VMe4ud9AmEPse0vEvF3sqO4PlJZULqU4IW6MLVRR83TC9utiUw44WWtI GdJ7xlJ6W7vbiBZ94Qj3ZnyqjJgpAiebgR88rKyCwWJ0CGrkt0SzJ93XvW39EVN1zGFjaNZ/1hnwy I28qIptt3AJzT47yfkht4IyLw5YLphDvNw+PnIHLFAUIOsDkxEPjqMxWEXMm0altsnqYnyhxkDRg6 QsiU3EdxNz1gCciq6oOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oIEF4-00FELu-Gu; Sun, 31 Jul 2022 19:04:46 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oIEEw-00FEDi-3V; Sun, 31 Jul 2022 19:04:41 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4459AB80DC8; Sun, 31 Jul 2022 19:04:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F59BC433D7; Sun, 31 Jul 2022 19:04:33 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1oIEEq-007G2B-0I; Sun, 31 Jul 2022 15:04:32 -0400 Message-ID: <20220731190431.934571546@goodmis.org> User-Agent: quilt/0.66 Date: Sun, 31 Jul 2022 15:03:30 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Greg Kroah-Hartman , Chunfeng Yun Subject: [for-next][PATCH 01/21] USB: mtu3: tracing: Use the new __vstring() helper References: <20220731190329.641602282@goodmis.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220731_120438_338028_7194A0B2 X-CRM114-Status: GOOD ( 13.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Steven Rostedt (Google)" 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 Cc: Andrew Morton Cc: linux-usb@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mediatek@lists.infradead.org Acked-by: Greg Kroah-Hartman Tested-by: Chunfeng Yun Signed-off-by: Steven Rostedt (Google) --- drivers/usb/mtu3/mtu3_trace.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_trace.h b/drivers/usb/mtu3/mtu3_trace.h index 1b897636daf2..a98fa012b729 100644 --- a/drivers/usb/mtu3/mtu3_trace.h +++ b/drivers/usb/mtu3/mtu3_trace.h @@ -18,18 +18,16 @@ #include "mtu3.h" -#define MTU3_MSG_MAX 256 - TRACE_EVENT(mtu3_log, TP_PROTO(struct device *dev, struct va_format *vaf), TP_ARGS(dev, vaf), TP_STRUCT__entry( __string(name, dev_name(dev)) - __dynamic_array(char, msg, MTU3_MSG_MAX) + __vstring(msg, vaf->fmt, vaf->va) ), TP_fast_assign( __assign_str(name, dev_name(dev)); - vsnprintf(__get_str(msg), MTU3_MSG_MAX, vaf->fmt, *vaf->va); + __assign_vstr(msg, vaf->fmt, vaf->va); ), TP_printk("%s: %s", __get_str(name), __get_str(msg)) );