Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp2350274imi; Sun, 24 Jul 2022 16:49:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sosSkzFcXhnAah4qTUbKwyUnAANnmm75cGULRCanyPiwLlvlJRyu1m3HCx6RldBnxpnbxY X-Received: by 2002:a17:906:98c9:b0:72b:40de:9afe with SMTP id zd9-20020a17090698c900b0072b40de9afemr8210062ejb.620.1658706563488; Sun, 24 Jul 2022 16:49:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658706563; cv=none; d=google.com; s=arc-20160816; b=rS6SpjLNS7qUh2Vg5AHhgmBJDISYPpJknkr4lizaUztfCtDf0mQ05nuYwsodgge+ck 4hQI9mzLvlcJZ872DLxlMk2EG2E1G6FV8UenPTlQ30FOzutEkvU2l6BiGseBKLfWPQtJ ZJv6y66p3AVadV8iClwe64ifx4No1xt4bFViSkUePHBo0PKmQLX+Cd2xiRF1wVyzAx5V vDKGYqQTSMAirF2VYTb4hDdhqf8an54yqRUwxVvITf73eu+gjN9VQZHTT8i1Fc5NwUeT 3gh/Z7qoozkDrI1KqTR9ql+KRuSrjF9d7jeISaimqhc9ptM0IwKWoejtLpSapSgdEk3t X3oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:subject:cc:to:from:date; bh=OsH5Iq2AVdc1EIe19MiGqEU5mAHkaGgVzb1wYZ5et1w=; b=k7Mtim/9DrtsF9dpzKn4ijcwqpJqcIdb++I3JPzWj1CQ4tUrhvYFPWjJKHpDTb4MU0 HNUJ1KMinofs+IIsl1f7CLe5xZuNi68RUx6ajEsKDiJ9468IOrJLlPhU5upWfXDRS8cc xSzZm2yY3q1hqAY27O60tLxPVY/V6Net5G9x0IL9MKHjGdxKjpCdOkg36Qvyw/lFcdze /uOpVtobingf2QDF406NMmpo/4t0pMIaW8PMpscOHssdvqsYvWr/6qOVLjDud59leVv3 D34CL0Xx2xokqdMx3nrKeMQ5XWVheHCUaClI0uYAD2/pygmgHr9CEGUV/VPlVT80r72W YTog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr21-20020a170906d55500b0072b44b630absi6814246ejc.867.2022.07.24.16.48.58; Sun, 24 Jul 2022 16:49:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231136AbiGXXRA (ORCPT + 99 others); Sun, 24 Jul 2022 19:17:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229687AbiGXXQ6 (ORCPT ); Sun, 24 Jul 2022 19:16:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E804BD79; Sun, 24 Jul 2022 16:16:55 -0700 (PDT) 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 91B75B80DD1; Sun, 24 Jul 2022 23:16:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA9ABC341C0; Sun, 24 Jul 2022 23:16:51 +0000 (UTC) Date: Sun, 24 Jul 2022 19:16:50 -0400 From: Steven Rostedt To: LKML Cc: Ingo Molnar , Andrew Morton , Marek Lindner , Simon Wunderlich , Antonio Quartulli , Sven Eckelmann , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org Subject: [PATCH v2] batman-adv: tracing: Use the new __vstring() helper Message-ID: <20220724191650.236b1355@rorschach.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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. Cc: Marek Lindner Cc: Ingo Molnar Cc: Andrew Morton Cc: Simon Wunderlich Cc: Antonio Quartulli Cc: Sven Eckelmann Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: b.a.t.m.a.n@lists.open-mesh.org Cc: netdev@vger.kernel.org Signed-off-by: Steven Rostedt (Google) --- Changes since v1: https://lkml.kernel.org/r/20220705224751.080390002@goodmis.org - Removed no longer used BATADV_MAX_MSG_LEN net/batman-adv/trace.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/net/batman-adv/trace.h b/net/batman-adv/trace.h index d673ebdd0426..31c8f922651d 100644 --- a/net/batman-adv/trace.h +++ b/net/batman-adv/trace.h @@ -28,8 +28,6 @@ #endif /* CONFIG_BATMAN_ADV_TRACING */ -#define BATADV_MAX_MSG_LEN 256 - TRACE_EVENT(batadv_dbg, TP_PROTO(struct batadv_priv *bat_priv, @@ -40,16 +38,13 @@ TRACE_EVENT(batadv_dbg, TP_STRUCT__entry( __string(device, bat_priv->soft_iface->name) __string(driver, KBUILD_MODNAME) - __dynamic_array(char, msg, BATADV_MAX_MSG_LEN) + __vstring(msg, vaf->fmt, vaf->va) ), TP_fast_assign( __assign_str(device, bat_priv->soft_iface->name); __assign_str(driver, KBUILD_MODNAME); - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), - BATADV_MAX_MSG_LEN, - vaf->fmt, - *vaf->va) >= BATADV_MAX_MSG_LEN); + __assign_vstr(msg, vaf->fmt, vaf->va); ), TP_printk( -- 2.35.1