Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35998419rwd; Mon, 10 Jul 2023 16:18:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlEC2yVOmVnfyw5c9ZpssSwRr7othSt3IHgp6JDvn+VahkQo8KEixC2eDNdVxB+jBXiJh2wu X-Received: by 2002:a05:6a20:3d92:b0:126:9539:ec30 with SMTP id s18-20020a056a203d9200b001269539ec30mr12999805pzi.19.1689031138820; Mon, 10 Jul 2023 16:18:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689031138; cv=none; d=google.com; s=arc-20160816; b=jEeX6ddVVRBbe5ReJu3PmPYc6nHurnVPN/YIxPBybWIKrFRFFmHCNcBjj+mDFcyX63 MrNbxFRbWKK/A3RXKMN8FdKgrPZP2BZV98aqO4THTXPNCXjaCGRslbFxjdPqoNh+1z5i TOw2o1XyMCxzpKwjRAPd+L0Ca8A51xBzlcRW2YJNo8zkB6GDR1j8nRphGDh1XFnJdMHs PcQWs1WO44daqorEXPuAboFH6642+retFdgq0Cncj68Zhq+Wu4giwwa20K1Mtt+hjkW2 iTzLYdn2xgo0Qzr7e5IDr93Gm/eFaYEJEiW8tCC6BJP67l9ujRBpEZCN12qZ6sIteyUB pu1g== 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; bh=WzaIkWWy/2SD+XbdFhmFwNNX2yoQNQ0oNUNqVUZjy5o=; fh=S+VQdfwDDtcZiDpcQtNjhDrZY714iPQH5yCJJ8f/AJo=; b=eIHrzdzwcxJuKEmmd1Xf94SUAX18/sW8CjiWmlZg+xALE/icJgGs1YJwjCkjm5oXXJ DTHfNY7xBgH9gis327sgbCsJ0RMTkQKtoYCxoclT24jyvOqbJQoU/SRu1cE9hEg2l9rR adJ7cY3g5A84BkkYh/kQ+qFKlJ7HiLoM1rbpRQ3Zaep8VOiAdY9Av0uOh7R5A1c3oBAs Xq9qqD6RD2sbWx8KMc0eRrR3jTc2GzqhYuIBBR8i58MDX2fwEj19rm6xbLhuKoBFAanv 6yPbTn72xs1od7QHzJlsJKkAggl4rYzIlpYnwFjoSf83xifQjBpiuVUYTiKoxNVCwXUc Cp7Q== 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 v21-20020a170902f0d500b001b8a3894576si497045pla.64.2023.07.10.16.18.44; Mon, 10 Jul 2023 16:18:58 -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 S230219AbjGJWoA (ORCPT + 99 others); Mon, 10 Jul 2023 18:44:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229612AbjGJWn7 (ORCPT ); Mon, 10 Jul 2023 18:43:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EABF9C; Mon, 10 Jul 2023 15:43:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A1A666123D; Mon, 10 Jul 2023 22:43:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 330DEC433C7; Mon, 10 Jul 2023 22:43:56 +0000 (UTC) Date: Mon, 10 Jul 2023 18:43:53 -0400 From: Steven Rostedt To: Andy Shevchenko Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Masami Hiramatsu Subject: Re: [PATCH v1 1/1] f2fs: Use return value of strreplace() Message-ID: <20230710184353.09640aee@gandalf.local.home> In-Reply-To: <20230628150243.17771-1-andriy.shevchenko@linux.intel.com> References: <20230628150243.17771-1-andriy.shevchenko@linux.intel.com> X-Mailer: Claws Mail 3.19.1 (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, 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 On Wed, 28 Jun 2023 18:02:43 +0300 Andy Shevchenko wrote: > Since strreplace() returns the pointer to the string itself, > we may use it directly in the code. > > Signed-off-by: Andy Shevchenko > --- > include/trace/events/f2fs.h | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h > index 793f82cc1515..f5994515290c 100644 > --- a/include/trace/events/f2fs.h > +++ b/include/trace/events/f2fs.h > @@ -2234,13 +2234,11 @@ DECLARE_EVENT_CLASS(f2fs__rw_start, > * because this screws up the tooling that parses > * the traces. > */ > - __assign_str(pathbuf, pathname); > - (void)strreplace(__get_str(pathbuf), ' ', '_'); > + __assign_str(pathbuf, strreplace(pathname, ' ', '_')); But this modifies the pathname that is passed into the trace event, which is something that a trace point should never do! In fact, the char *pathname, really should be a const char * (for which this would fail to build). Note, I went to look for these events and I can not find where they are used. Should these events just be deleted? -- Steve > __entry->offset = offset; > __entry->bytes = bytes; > __entry->i_size = i_size_read(inode); > - __assign_str(cmdline, command); > - (void)strreplace(__get_str(cmdline), ' ', '_'); > + __assign_str(cmdline, strreplace(command, ' ', '_')); > __entry->pid = pid; > __entry->ino = inode->i_ino; > ),