Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp3664602rwp; Sat, 15 Jul 2023 07:09:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlHkmuZaLFyfMysQhzLsnjfcc1f2atRkkrNPpMS1mXXf6Jclu2GNQMgdqz6x0SlNchVugZJY X-Received: by 2002:a5d:4883:0:b0:2f5:7487:7b3d with SMTP id g3-20020a5d4883000000b002f574877b3dmr1491062wrq.1.1689430180192; Sat, 15 Jul 2023 07:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689430180; cv=none; d=google.com; s=arc-20160816; b=NMzgyZUro0bh7Ew4dW3SxZRBc0Obyy3E5MeNvmfVLCF3CgjcswF+OMFRqVEFdJE3ZQ biRbb2MEjEdLK9p6q7eRAuU21VcaoFaC9cWcz3q7k2RPcQIld88msVn3EBZkFhEC7WCz /VaqTCb0ciHdmMU6YASOBOp2pkC9o6rdeOvfxjrOBXQHUZQ0ZtJLT+tKqKui/NZ10BMj t1ukbS2+cUbUxYUPwpWS/8VetzGHfuNjfIDJ57S+SqDt6uiS5ONz3KdBhRb17fJMbOqE i2V11NiPo8Pm1m/JFh1yhoiiyCWPV0BqZXjRX4r8MNOddkdpZEaSjwH0apje1BQyjjbc b/6Q== 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=YureVaUSdKMUWEN3+UlvebK4oFyW7qTBO07IFQ0BI6M=; fh=oV4rtEGZh2nJh0G9u3UoYY0gntBrXwWOCcCgFdfAVIg=; b=QimAq3sV/wYEK7LNEgqU6clsoSNLEEs/uhJHPzCxA9TP3iDOi9ZIQ4TIG9eJXb7VKs QlZMq+uLMzYSu6ydudSeSP1qzn1WJQGkZc/m0cMmIfE/xT4NFJ3YYpYbRkhBroVEN6NZ ClV9Nc+2LY8nN+0GurMklZCkhQMoTLwbEV5RwwOWvZZnpasHjF9Riuwfd9NXTrCusptB oAhbzgPSIO2H3z9RSsiiEfnrKHtZVVDYUJ6nH6PKX0DorwVVVushnAm7osMvbkg/OQXg ia0u2fmgw7XuACke78xO6mAK/wd7nCfuBfGXBG34OoXBCC6uxXPQAiPS575rQruytAdB YGzA== 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 f14-20020a170906048e00b00993b3881ecbsi3222015eja.682.2023.07.15.07.09.14; Sat, 15 Jul 2023 07:09:40 -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 S229767AbjGONy1 (ORCPT + 99 others); Sat, 15 Jul 2023 09:54:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbjGONy0 (ORCPT ); Sat, 15 Jul 2023 09:54:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DCDC10DC; Sat, 15 Jul 2023 06:54:25 -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 F0EC360B98; Sat, 15 Jul 2023 13:54:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50C3FC433C8; Sat, 15 Jul 2023 13:54:23 +0000 (UTC) Date: Sat, 15 Jul 2023 09:54:19 -0400 From: Steven Rostedt To: Zheng Yejian Cc: LKML , Linux Trace Kernel , Masami Hiramatsu , Mark Rutland Subject: Re: [PATCH 2/2] tracing: Add free_trace_iter_content() helper function Message-ID: <20230715095419.3af9ec19@rorschach.local.home> In-Reply-To: <20230715094201.34a41f17@rorschach.local.home> References: <20230713114510.04c452ca@gandalf.local.home> <20230713114700.450e7a17@gandalf.local.home> <20230715094201.34a41f17@rorschach.local.home> X-Mailer: Claws Mail 3.17.8 (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=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 Sat, 15 Jul 2023 09:42:01 -0400 Steven Rostedt wrote: > On Sat, 15 Jul 2023 13:15:32 +0800 > Zheng Yejian wrote: > > > > @@ -6709,7 +6723,12 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp) > > > } > > > > > > trace_seq_init(&iter->seq); > > > - iter->trace = tr->current_trace; > > > + > > > + iter->trace = kzalloc(sizeof(*iter->trace), GFP_KERNEL); > > > + if (!iter->trace) > > > + goto fail; > > > > Hi, Steve, 'ret' may need to be set before `goto fail`: > > ret = -ENOMEM; > > > > As I mentioned to Masami, this hunk of the patch didn't belong. > Something got mixed up in the commit. This patch even depends on the > previous patch to remove the allocation completely. > I know what I did now. I first started writing this patch and saw that the iter->trace was inconsistent and in one place allocated a copy and here it did not. I started to make the copy here, when I realized that there was no reason to make that copy. Then I wrote the first patch to remove the copying, but forgot to remove the copying I added in this patch! :-p -- Steve