Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4383438iog; Tue, 21 Jun 2022 19:12:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uV3fD6sRx003ARDW6ZFZqagr6u76Osxa5JQqH1h8PNv3LQXPU/sZg5w4xjvjgyjtG4BXnH X-Received: by 2002:aa7:c054:0:b0:433:2d3b:10ed with SMTP id k20-20020aa7c054000000b004332d3b10edmr1308272edo.211.1655863965378; Tue, 21 Jun 2022 19:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655863965; cv=none; d=google.com; s=arc-20160816; b=LZNodglJBHqqCCT3IVg5z2sEMQnbLTgTVxrLEZHECnxCYvSIiP7CsHV5b0zNl1i7ru oSj8Tz6tBf0xLxsgnKDlMODX6vQTkJYghIwd+384ECNc6N73dqPqKxCV1eTV5K0PJq5/ JGwnvXCjhDIp/l+5cj2H4NVb8cdn5vkNXaLjDpL0ZhhRMcBxo2RqzhEa5jbvk9AxpTIY 48FuM+CUZOsvPiVkWnqVIWvRX3T1I8SCCKQCKMjgSiF5nk8QqcKGb/EbaK6vuEFF3VNT qyc8aeatit+E3OiAGnIpMQhzmBAOTkNNhZoRH7ezeFKSTstybvS7kGzMJHzYXBZwvowQ qTMg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=0ySNk+Jb1t2XHLjuW+PBRTj8HrLKtuxJoOku6uOPKO4=; b=qeMzAcd21DyBzY6hpt1nU2HsTLbWksbBFmaQSlda3BoSLML7nsl4/J94cnzR1rpv+/ HgaFuP2zYpbTSkCLCvldAEo2AJmlWuOjhXCfFzgIMVaWmDPSgW1MmeSSRV50J5OEBvYq xX+DOLHzxApWCBb8HsVqUfA/tZCM9jYeuHD4WwB4zXcOzNjqt/W/LIuUtTOB+37DwikE Q/7Hc/ijdBm0vuw/A0fNOOLMUnB39f1p4S+9r95rHoMxQay1HG+mY1kZJlg15hztiKnK bkB/pvbTk0EMXyf8yN94CQolhYzsEmmS5BsgdzQUORQ0irwt/TAj9CT8JLavaB+WeaVB fhvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Pq8NPvLi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r9-20020a05640251c900b004355a6d2eefsi19429261edd.618.2022.06.21.19.12.20; Tue, 21 Jun 2022 19:12:45 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Pq8NPvLi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355974AbiFVCHI (ORCPT + 99 others); Tue, 21 Jun 2022 22:07:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232424AbiFVCHH (ORCPT ); Tue, 21 Jun 2022 22:07:07 -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 5415830F54 for ; Tue, 21 Jun 2022 19:07:06 -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 EFBB2B80F63 for ; Wed, 22 Jun 2022 02:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 400FBC3411C; Wed, 22 Jun 2022 02:07:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655863623; bh=OXkI+Y3ACw9rL792ik2Ukzt4EMax3yvVetAu+tTRfR4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Pq8NPvLimKNdXKMDLmHptp5BwZwiNacaYPqJr3LQ7hrl/I0adOh5STROXBTLJwNrT MfLZaybCui5QzqEbDWIsZWw4MGjh+ZVs4YIWjJQ4a9lb7QgyPBvaT2PssJp6dLog2D 0gKlHHN+7BHwr0IMx3GhP2f9V7k/gcjOic02uSe5WHxZY47UoDAaeCE/LNUgl6tlL7 qHHVa2G5wzca8mD+jllPuOwqQIXCHg2kb2oADB3jDJ4aZw6T101CO0gUZ+mGoyO/Rs WEgbAobtJFN3bT42iz2UgJ4mM9ogrTKfAPADbCUYb8EdtJ2pOh0menpAv03N3DAZc5 kIdKU43kkTR9Q== Date: Wed, 22 Jun 2022 11:06:59 +0900 From: Masami Hiramatsu (Google) To: Tiezhu Yang Cc: Steven Rostedt , Xuefeng Li , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] samples: Use KSYM_NAME_LEN for kprobes Message-Id: <20220622110659.74a269678bc7c37e15cdebaf@kernel.org> In-Reply-To: <1654651402-21552-1-git-send-email-yangtiezhu@loongson.cn> References: <1654651402-21552-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; 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=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, 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 Hi, On Wed, 8 Jun 2022 09:23:22 +0800 Tiezhu Yang wrote: > It is better and enough to use KSYM_NAME_LEN for kprobes > in samples, no need to define and use the other values. This looks good to me. Acked-by: Masami Hiramatsu (Google) Thank you! > > Signed-off-by: Tiezhu Yang > --- > samples/kprobes/kprobe_example.c | 5 ++--- > samples/kprobes/kretprobe_example.c | 5 ++--- > 2 files changed, 4 insertions(+), 6 deletions(-) > > diff --git a/samples/kprobes/kprobe_example.c b/samples/kprobes/kprobe_example.c > index f991a66..fd346f5 100644 > --- a/samples/kprobes/kprobe_example.c > +++ b/samples/kprobes/kprobe_example.c > @@ -16,9 +16,8 @@ > #include > #include > > -#define MAX_SYMBOL_LEN 64 > -static char symbol[MAX_SYMBOL_LEN] = "kernel_clone"; > -module_param_string(symbol, symbol, sizeof(symbol), 0644); > +static char symbol[KSYM_NAME_LEN] = "kernel_clone"; > +module_param_string(symbol, symbol, KSYM_NAME_LEN, 0644); > > /* For each probe you need to allocate a kprobe structure */ > static struct kprobe kp = { > diff --git a/samples/kprobes/kretprobe_example.c b/samples/kprobes/kretprobe_example.c > index 228321e..cbf1654 100644 > --- a/samples/kprobes/kretprobe_example.c > +++ b/samples/kprobes/kretprobe_example.c > @@ -23,11 +23,10 @@ > #include > #include > #include > -#include > #include > > -static char func_name[NAME_MAX] = "kernel_clone"; > -module_param_string(func, func_name, NAME_MAX, S_IRUGO); > +static char func_name[KSYM_NAME_LEN] = "kernel_clone"; > +module_param_string(func, func_name, KSYM_NAME_LEN, 0644); > MODULE_PARM_DESC(func, "Function to kretprobe; this module will report the" > " function's execution time"); > > -- > 2.1.0 > -- Masami Hiramatsu (Google)