From patchwork Mon Aug 15 18:07:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 18509 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 1ECAB83DCE; Mon, 15 Aug 2022 22:49:16 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by diktynna.open-mesh.org (Postfix) with ESMTPS id 21226802C6 for ; Mon, 15 Aug 2022 22:49:12 +0200 (CEST) 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 9DB08B811A0; Mon, 15 Aug 2022 20:49:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0BF5C433D6; Mon, 15 Aug 2022 20:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596550; bh=ZVE2RNHPOttuDHZ2xX2gbbcEhpFNhv9Nt5X6GeRZKSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cUkQtYIDzoOpYCzOKmbhgMMr5vl7QPNPhlItf34lzDhv3ryYDyHMbmMReGhlQxrlt km1KxFYXliLYUSXFtaeoQdZBkvfhgLipR378qM8LbRtoF+QmmIoayMDuE0h3p97vPz SDJtrzo9rjBMTHQcUKQn+1aJCbKC8ENgEPUVl0z8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Subject: [PATCH 5.19 1114/1157] batman-adv: tracing: Use the new __vstring() helper Date: Mon, 15 Aug 2022 20:07:50 +0200 Message-Id: <20220815180524.874593378@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1660596552; a=rsa-sha256; cv=none; b=4CtHdRbB/6yhe8XEtQWiZvxuNbNaHLIu//4oevRq05TiYNI8iyyp6kWC3dJa4zaAP+54/v 0owG5e7xHIPOKcXJmcf3tsnmArPZ4M6MBhyEsdchEWREs5o4jBvJMU+sPeOSM4BnMfbkYI bf4SiS3lSjC143bbEsx4FLnvwiR+W8A= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=cUkQtYID; spf=pass (diktynna.open-mesh.org: domain of gregkh@linuxfoundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1660596552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=oUpEtPLjd5lzB6PrtVjBb61iZmZBxSpE4KoB9sGMLSE=; b=kYRxT+BnHryodgb/XDOKeffCF7tBM8BFUwEcoCy+gfr2XDkdUfH7QEUYPbvR2toiSPML1Y CrHstgpFZb80kcYO2QAzrJM7ayEo2KUgqGdw3gv5PIfZ5vF8pHU9OjCHPx5Wxu8TE3vO8O 0HaLAkJM7yIefYHoqBr4KYyvZW57dyo= Message-ID-Hash: P23XMSM6FK5AKP7WCOYCRZ6RRQGCTORW X-Message-ID-Hash: P23XMSM6FK5AKP7WCOYCRZ6RRQGCTORW X-MailFrom: gregkh@linuxfoundation.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1 CC: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Lindner , Ingo Molnar , Andrew Morton , Antonio Quartulli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org, "Steven Rostedt (Google)" , Sasha Levin X-Mailman-Version: 3.2.1 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Steven Rostedt (Google) [ Upstream commit 9abc291812d784bd4a26c01af4ebdbf9f2dbf0bb ] 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/20220724191650.236b1355@rorschach.local.home Cc: Marek Lindner Cc: Ingo Molnar Cc: Andrew Morton Cc: Simon Wunderlich Cc: Antonio Quartulli 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 Acked-by: Sven Eckelmann Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- 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(