Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp737993imw; Thu, 14 Jul 2022 09:56:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v8clFmaDqFm5EJq7shdVUQexuUdb2PEYpda08U13u4NNulbfR1DRy0+9diZCDfeGQHWwEr X-Received: by 2002:a17:907:2cc8:b0:72b:7c72:e6a4 with SMTP id hg8-20020a1709072cc800b0072b7c72e6a4mr9961711ejc.160.1657817810346; Thu, 14 Jul 2022 09:56:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657817810; cv=none; d=google.com; s=arc-20160816; b=wkmVxMi99nsMf8cnnV7zEekycdvlH6jQAShghRBBRg98Ay8IwIGZuY4rtrU4PzOC0P BznwbihIebJ4tKoQRopOChn0OCQ1drscioa1Dm0KyJGySFU7Gk6nZ6Md8paFvhPiKADW Rhf4ZLLinEMxAHsZyI/Vq9+QbX6yCCdlD21+zInrUNdHkAUDheNZtHzvC6Cln5vXfbUx Ju5E+wSN2Q4giLgpuyL5NVA2a+D0ov7IGqB+ZHZJshaigjZ2flLv7zoID1rBuq/UpQWA TBD6ANJ/pmv+DsgRg3VGx1AusCAaHeW33eLmbmwimsMSrFxWIlTrhjNRlQkbDT1jxUpS BbFA== 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=QllWGlGnb/m5+aB1CRWO/GiVLb3eP/h1KORORUpvRrc=; b=GBCIAf9l9YRU5LQIhmtjBInsWFZ8RFuUqdLGGkarV14oQ2uevLvlddqF2tjsVfJMja gOj643er+S9YpC0XZrSgYAnXXihc7uzypVmDKK8cpHwPuMh/UavpoEdhdbn4WHjR2g9b 1YnjxZzl2nP11qdcckU2qDAC4F1P1C5ru2yhEjFLGREp3wazZQEk+GGey0Codj1QO97y QcdJprQQzces+QpAUV55k+R2muqWa2iDVfafknMJnHanwaQ71+CIlzT52uZmOaowDt9a /Nx/UkaaleGu8Ood8WJAOLCITVvX4qh9J33kPmCbqTcezNnInB9bVCXeD3krcAqW+ZaZ +uLw== 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 p2-20020a056402500200b0043572af468asi1785919eda.522.2022.07.14.09.56.25; Thu, 14 Jul 2022 09:56:50 -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 S238288AbiGNQnn (ORCPT + 99 others); Thu, 14 Jul 2022 12:43:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235187AbiGNQng (ORCPT ); Thu, 14 Jul 2022 12:43:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1BBB4B0F4; Thu, 14 Jul 2022 09:43:30 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 3046262053; Thu, 14 Jul 2022 16:43:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9458BC341CE; Thu, 14 Jul 2022 16:43:29 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.95) (envelope-from ) id 1oC1w0-004lMO-KB; Thu, 14 Jul 2022 12:43:28 -0400 Message-ID: <20220714164328.461963902@goodmis.org> User-Agent: quilt/0.66 Date: Thu, 14 Jul 2022 12:42:59 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , Leon Romanovsky , Jiri Pirko , "David S. Miller" , Eric Dumazet , Paolo Abeni , netdev@vger.kernel.org, Jakub Kicinski Subject: [for-next][PATCH 03/23] tracing: devlink: Use static array for string in devlink_trap_report even References: <20220714164256.403842845@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-kernel@vger.kernel.org From: "Steven Rostedt (Google)" The trace event devlink_trap_report uses the __dynamic_array() macro to determine the size of the input_dev_name field. This is because it needs to test the dev field for NULL, and will use "NULL" if it is. But it also has the size of the dynamic array as a fixed IFNAMSIZ bytes. This defeats the purpose of the dynamic array, as this will reserve that amount of bytes on the ring buffer, and to make matters worse, it will even save that size in the event as the event expects it to be dynamic (for which it is not). Since IFNAMSIZ is just 16 bytes, just make it a static array and this will remove the meta data from the event that records the size. Link: https://lkml.kernel.org/r/20220712185820.002d9fb5@gandalf.local.home Cc: Leon Romanovsky Cc: Jiri Pirko Cc: "David S. Miller" Cc: Eric Dumazet Cc: Paolo Abeni Cc: netdev@vger.kernel.org Acked-by: Jakub Kicinski Signed-off-by: Steven Rostedt (Google) --- include/trace/events/devlink.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/trace/events/devlink.h b/include/trace/events/devlink.h index 2814f188d98c..24969184c534 100644 --- a/include/trace/events/devlink.h +++ b/include/trace/events/devlink.h @@ -186,7 +186,7 @@ TRACE_EVENT(devlink_trap_report, __string(driver_name, devlink_to_dev(devlink)->driver->name) __string(trap_name, metadata->trap_name) __string(trap_group_name, metadata->trap_group_name) - __dynamic_array(char, input_dev_name, IFNAMSIZ) + __array(char, input_dev_name, IFNAMSIZ) ), TP_fast_assign( @@ -197,15 +197,14 @@ TRACE_EVENT(devlink_trap_report, __assign_str(driver_name, devlink_to_dev(devlink)->driver->name); __assign_str(trap_name, metadata->trap_name); __assign_str(trap_group_name, metadata->trap_group_name); - __assign_str(input_dev_name, - (input_dev ? input_dev->name : "NULL")); + strscpy(__entry->input_dev_name, input_dev ? input_dev->name : "NULL", IFNAMSIZ); ), TP_printk("bus_name=%s dev_name=%s driver_name=%s trap_name=%s " "trap_group_name=%s input_dev_name=%s", __get_str(bus_name), __get_str(dev_name), __get_str(driver_name), __get_str(trap_name), __get_str(trap_group_name), - __get_str(input_dev_name)) + __entry->input_dev_name) ); #endif /* _TRACE_DEVLINK_H */ -- 2.35.1