Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4154839ioa; Tue, 26 Apr 2022 19:01:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmrX2EvY0p3s7Uo5+1DtmE+Lb+k90iam1BPHvqWz+QqvZcZYFZInoLIFqGUZGVBkC3PZHs X-Received: by 2002:a17:902:e393:b0:15c:f1c1:c527 with SMTP id g19-20020a170902e39300b0015cf1c1c527mr18923654ple.22.1651024897914; Tue, 26 Apr 2022 19:01:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651024897; cv=none; d=google.com; s=arc-20160816; b=h+VFgnK6cRmcaxvYevo+NG0LLONi90bozxU+JIuwmlk2336raWYuoB6KPXjVp0mFrY Qn4kZSVo/KwA1HQeQR1dHzllDtMhH2fyOhg3bKoJr9KZ6IoTva2exZ4cvhaLSskb16Wf nVwpK4IA7WzdRlb1k9IRUMHDvYJvdtxlqSBMDMAVztLs4gLMxdv+LrXA0I3+XHhoYxCZ 5NnUC4BXvw9vdCbzWRqxG0G1sKlFY+KyCvaB6YYmYsP0GFx77MRPwMg9nmMgsMZ2+wxI uZMAz+97K8jh/8XWu29aPR46ELEnO0Jwa1VaJMMLkvY1KHKSUPrLMgnyZ9vyu6Epu9cU KkIA== 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=J2JwE9IW4GocOTBCgQgQzo4TnR8LGf4buRwfeCapLt8=; b=lW9bJXt2dhElShryOYXOauQ1kEDqOHyJVy7zFLjodfO9K9o3a2pjbfId3fyI4F/GDc MrYrH7VtsdWncQzKzH3PC0syuQGO9caCS2Dxl3SpG+Z+Z7tKKiCPUynRUzTBqmF9scJn NmbKLlu/rBJTNrc4/hovwtn+1dFchPoUC/T0h9EYdnMVhN0lOCdegVaD5sr3IqRP/Rdd UY1mV5rj+KLyB+dwI1EFiN+qwS4l/hAgSiSAxe+9h4QDOpPQcE30wBpR91MWCViVgd9L YeSXKDpHQ6lffiafeX+FNp1W+4Py/FdEYnXQcVCngyLX7zrmamQOqlTXX0w5U6YuDjXT 5AXA== 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 i6-20020a170902cf0600b0015c96aea0c1si255707plg.270.2022.04.26.19.01.18; Tue, 26 Apr 2022 19:01:37 -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 S1351587AbiDZO0a (ORCPT + 99 others); Tue, 26 Apr 2022 10:26:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351588AbiDZO00 (ORCPT ); Tue, 26 Apr 2022 10:26:26 -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 052B847AED for ; Tue, 26 Apr 2022 07:23:17 -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 9A265B82047 for ; Tue, 26 Apr 2022 14:23:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E0EEC385AA; Tue, 26 Apr 2022 14:23:14 +0000 (UTC) Date: Tue, 26 Apr 2022 10:23:12 -0400 From: Steven Rostedt To: Jakob Koschel Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Mike Rapoport , "Brian Johannesmeyer" , Cristiano Giuffrida , "Bos, H.J." Subject: Re: [PATCH v2 2/4] tracing: Remove usage of list iterator variable after the loop Message-ID: <20220426102312.70319297@gandalf.local.home> In-Reply-To: <20220402103341.1763932-3-jakobkoschel@gmail.com> References: <20220402103341.1763932-1-jakobkoschel@gmail.com> <20220402103341.1763932-3-jakobkoschel@gmail.com> 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=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS 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 Sat, 2 Apr 2022 12:33:39 +0200 Jakob Koschel wrote: This patch crashed in my testing. > @@ -1734,14 +1734,16 @@ static int subsystem_open(struct inode *inode, struct file *filp) > /* Make sure the system still exists */ > mutex_lock(&event_mutex); > mutex_lock(&trace_types_lock); > - list_for_each_entry(tr, &ftrace_trace_arrays, list) { > - list_for_each_entry(dir, &tr->systems, list) { > - if (dir == inode->i_private) { > + list_for_each_entry(iter_tr, &ftrace_trace_arrays, list) { > + list_for_each_entry(iter_dir, &iter_tr->systems, list) { > + if (iter_dir == inode->i_private) { > /* Don't open systems with no events */ > - if (dir->nr_events) { > + if (iter_dir->nr_events) { > __get_system_dir(dir); > system = dir->subsystem; system = NULL->subsystem > } > + tr = iter_tr; > + dir = iter_dir; But do not change that dir, move the setting above it. That is: tr = iter_tr; dir = iter_dir; if (iter_dir->nr_events) { __get_system_dir(dir); system = dir->subsystem; } -- Steve > goto exit_loop; > } > }