Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1793219imw; Tue, 5 Jul 2022 15:49:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sBqli90SPzbZwEBgNp0wv5KCunaynNiWoksENWaXbJ5JEEC9NKDesbaWeeXI75nxelxk1M X-Received: by 2002:a05:6a00:32c5:b0:525:933e:252f with SMTP id cl5-20020a056a0032c500b00525933e252fmr42388139pfb.26.1657061395715; Tue, 05 Jul 2022 15:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657061395; cv=none; d=google.com; s=arc-20160816; b=PgTDnxnhjy4IhPVHjrqKSHvTzEPWEObqzRnDzllHpNxvOlpFZs8q3wAaub6nEJox/A VnFmF9QsS7yXOKYxN6Tn7xFGhDhZBb4uSVUtuWpSWZQ/fAOxfOnoeQccVw3aMQgojvqc C5IhrIISqayVXkQ5317rkFSBYt80ovcC/6NLsm0fiTPwkeU+PtGbPVqO2JiJ9VtHH9Bq kUxsiDgpm19grfhWflumuNwsMbeqS6MIlg0xF3PnCAVes68sTNXF0+0+zWG+QPojz6EB Z/sEbj8Yu3buscZKcYjKOG0E57W0K9+xEaSb7NE/1SeG/SpYRZld1t3B7yZUUTqv1QfP kj0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id; bh=XEh4NdPnvg6d4ta3xI5SY/9gUP0pyiEeKGxrAznwTA0=; b=A1AIMGEL4LBQp9vzAK6p5A63v6p08PsFWNx6/Mq2tAGy+bEUg2b+vv6ojyANbMh0XL 4FA2MKEmjDRehdtGh3pVvNKaozbgp4O/V/vDuoEuHZO1sCh3/VS17otfoTFbJXl2CJhj GNv5xgFytEI4L8Akwwhpsk+rCsrnWlk8bJtOtyTY8Rb4EIocZ7rcw7GIUO27g+lDipep k96aphe56lqz10Ig9XVsG2T9epjMIZogp4M3twc+jIXfvwwdpQCK3n1tGZKgIlryoJWO DmSFCeYWMGJ+4c0TRoVVjxEGCOw7ejK+4R0VjMUdCqlqIg4bEW0yXpG5x0uvpKCqHsqS /fSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-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 b11-20020a630c0b000000b0040d5dc5a9edsi46760876pgl.487.2022.07.05.15.49.47; Tue, 05 Jul 2022 15:49:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232906AbiGEWs0 (ORCPT + 66 others); Tue, 5 Jul 2022 18:48:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232699AbiGEWsL (ORCPT ); Tue, 5 Jul 2022 18:48:11 -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 9206D1BE9C; Tue, 5 Jul 2022 15:47:53 -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 1453FB81A3C; Tue, 5 Jul 2022 22:47:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0FE0C341D9; Tue, 5 Jul 2022 22:47:50 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.95) (envelope-from ) id 1o8rKf-001yIg-PS; Tue, 05 Jul 2022 18:47:49 -0400 Message-ID: <20220705224749.622796175@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 05 Jul 2022 18:44:57 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com, netdev@vger.kernel.org Subject: [PATCH 04/13] tracing/brcm: Use the new __vstring() helper References: <20220705224453.120955146@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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, T_SCC_BODY_TEXT_LINE 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-wireless@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: Arend van Spriel Cc: Franky Lin Cc: Hante Meuleman Cc: Kalle Valo Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: linux-wireless@vger.kernel.org Cc: brcm80211-dev-list.pdl@broadcom.com Cc: SHA-cyfmac-dev-list@infineon.com Cc: netdev@vger.kernel.org Signed-off-by: Steven Rostedt (Google) --- .../broadcom/brcm80211/brcmfmac/tracepoint.h | 12 ++++-------- .../brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h | 12 ++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h index 338c66d0c5f8..5a139d7ed47a 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h @@ -33,13 +33,11 @@ TRACE_EVENT(brcmf_err, TP_ARGS(func, vaf), TP_STRUCT__entry( __string(func, func) - __dynamic_array(char, msg, MAX_MSG_LEN) + __vstring(msg, vaf->fmt, vaf->va) ), TP_fast_assign( __assign_str(func, func); - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), - MAX_MSG_LEN, vaf->fmt, - *vaf->va) >= MAX_MSG_LEN); + __assign_vstr(msg, vaf->fmt, vaf->va); ), TP_printk("%s: %s", __get_str(func), __get_str(msg)) ); @@ -50,14 +48,12 @@ TRACE_EVENT(brcmf_dbg, TP_STRUCT__entry( __field(u32, level) __string(func, func) - __dynamic_array(char, msg, MAX_MSG_LEN) + __vstring(msg, vaf->fmt, vaf->va) ), TP_fast_assign( __entry->level = level; __assign_str(func, func); - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), - MAX_MSG_LEN, vaf->fmt, - *vaf->va) >= MAX_MSG_LEN); + __assign_vstr(msg, vaf->fmt, vaf->va); ), TP_printk("%s: %s", __get_str(func), __get_str(msg)) ); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h index 0e8a69ab909f..488456420353 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h @@ -28,12 +28,10 @@ DECLARE_EVENT_CLASS(brcms_msg_event, TP_PROTO(struct va_format *vaf), TP_ARGS(vaf), TP_STRUCT__entry( - __dynamic_array(char, msg, MAX_MSG_LEN) + __vstring(msg, vaf->fmt, vaf->va) ), TP_fast_assign( - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), - MAX_MSG_LEN, vaf->fmt, - *vaf->va) >= MAX_MSG_LEN); + __assign_vstr(msg, vaf->fmt, vaf->va); ), TP_printk("%s", __get_str(msg)) ); @@ -64,14 +62,12 @@ TRACE_EVENT(brcms_dbg, TP_STRUCT__entry( __field(u32, level) __string(func, func) - __dynamic_array(char, msg, MAX_MSG_LEN) + __vstring(msg, vaf->fmt, vaf->va) ), TP_fast_assign( __entry->level = level; __assign_str(func, func); - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), - MAX_MSG_LEN, vaf->fmt, - *vaf->va) >= MAX_MSG_LEN); + __assign_vstr(msg, vaf->fmt, vaf->va); ), TP_printk("%s: %s", __get_str(func), __get_str(msg)) ); -- 2.35.1