Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3455767pxb; Mon, 4 Apr 2022 17:32:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqeP5eAjjnd/+cq5erCYxjssUSMqz3clKdYX+FFrLIjsYzAbFJNGxkZxgdj5aRoeTvkrf/ X-Received: by 2002:a17:902:d083:b0:156:9182:d46c with SMTP id v3-20020a170902d08300b001569182d46cmr844029plv.134.1649118763183; Mon, 04 Apr 2022 17:32:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649118763; cv=none; d=google.com; s=arc-20160816; b=IGS2uNbMmyuFTcObkxhde6QDDe52MnPGAoRJRVWCOp2ji5UK31YvZhE2cN7e6bmY9N Q5psy8RCiHS5W2HTqvzd2D5RfnZ2rcr3BK7Tcl6CmK/Kcy3I9oCfLDQOtKd6OjV8dQLK Uz+000EoOOGsbYvS2B+zqe41bWjwVhtZQ1/i5YcQg+Pg1KlR7bGkBmD79uOdqD1mUiDc pM63uQpt+ReSYE1HxU66A9rtLHPGqotV0l7ksOgcF6e5kEdegZ50HVOLu7HWGFjuPBTf Ace9B5jxXf8RExxOW0ZBttd5iFBiYOJvAhS7+xOVLtpzamo2PmIujhvWz+prFP+Tsa8h Dg8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=WeeRCkZhxmtARzf06YltnRLpzhoYn2mfqbh7gF1oO98=; b=zLktq49M7Qra4R3Z0wy2C+LF9LPh1U+/Sx/9BUaR5cS4gLYeCTSgaODPd1eazmNy8+ pkOQ518szusbtJJEAeF2O5daT7MWUn6Oef5irssPIQ5KM71cb3XVnVYI2HHGsUM7aCYb V72EHZuSiRKLtUHQX6J4H/TmMUdK+rZ4Zoy3cRSSZHjkJJ91LyRwpNaiE2f0jox++ZHk zfYS2VzO4aVYsGNjYShhZxSE0rNFgsnFDWB729YMSJDXVimaRoxLOV2je2nxZefJ3DLf bUpvU5AEMCYSIHiN+ucULjPsvyidsrmFTopqFwKNGa0FTqk6XGL1v36xBVwRzvYJir1U zK4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm1 header.b=BZA6oC2P; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=bX0JCIe9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q11-20020a056a00084b00b004fa3a8e009dsi11574612pfk.340.2022.04.04.17.32.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:32:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm1 header.b=BZA6oC2P; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=bX0JCIe9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3D7985C37B; Mon, 4 Apr 2022 16:51:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235486AbiDCFEu (ORCPT + 99 others); Sun, 3 Apr 2022 01:04:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbiDCFEs (ORCPT ); Sun, 3 Apr 2022 01:04:48 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82FAC33EB8 for ; Sat, 2 Apr 2022 22:02:54 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id D1E793200D30; Sun, 3 Apr 2022 01:02:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 03 Apr 2022 01:02:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; bh=WeeRCkZhxmtARzf06YltnRLpzhoYn2 mfqbh7gF1oO98=; b=BZA6oC2Pcq0YOqfC+nC+driizm60Q3zn1Rw/v/NjET+Kp0 /rGHjKINSU22NqTZoDouOEw4iJfmO5GCVUY+tVhgHAZBsHMZlUeGc7yAqSEiWwMv WulEJuKr9rApl/bjko17VLvPvXvWY3ZhcPT4i7o2xB2Il3TNbGmwUd1ldmtTtDc4 aV/99s9FRiz4R8Kl59Ugk0cI29motgnNiORb/EB0aaYIDuZCWYamvEPGeIM5xpwb DmfLWyqCKUH/ltrzvurFyY0sRxKPwPN8s63S+fdR9dx8NKUXIKNTMxM9PLqiObVZ 1Yi/KhPoiJ9nuDSBa6euAjyKl7RHxAapi/1Fxtwg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=WeeRCkZhxmtARzf06 YltnRLpzhoYn2mfqbh7gF1oO98=; b=bX0JCIe9dSbss8GwNo95tUCB3aLr5Nt0z moHkSrwhHPrLFwXssMbkSXNuJemBlFWqpUwVGmA5cno6S6WwkLciwmMCKLZPo3SF ESY4izFB0yyMGzXZJQA8Vdfp4wcjBRXoWMwh50C3phpP0uvbq/cgPi3RMS7IzqZc JZmEsm3xfwufC6Tcnwq1kBssGHZcN3kKjI93WFhz3sZ4tYIs0K/6m0vDbyptONm5 /ABnQqwMKTtOpjT9AhVWiA6dMomLkiHg3AQytn9C4+gLi6oxrkjqekJxEDDfTZdt WOSNdZXl5iOB4RGf3Yahv+PUr1srI5ix7TQPJHTDf3hkkH/G6KidQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudeiledgkeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefvrghkrghs hhhiucfurghkrghmohhtohcuoehoqdhtrghkrghshhhisehsrghkrghmohgttghhihdrjh hpqeenucggtffrrghtthgvrhhnpeejgeeifeeuveeufeeigeegjeelvdfgjeegffejgfdv keelhefgtdefteejleekjeenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepohdqthgrkhgrshhh ihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 3 Apr 2022 01:02:49 -0400 (EDT) Date: Sun, 3 Apr 2022 14:02:47 +0900 From: Takashi Sakamoto To: Jakob Koschel Cc: Stefan Richter , linux-kernel@vger.kernel.org, "Bos, H.J." , Brian Johannesmeyer , Cristiano Giuffrida , linux1394-devel@lists.sourceforge.net, Mike Rapoport Subject: Re: [PATCH] firewire: remove check of list iterator against head past the loop body Message-ID: Mail-Followup-To: Jakob Koschel , Stefan Richter , linux-kernel@vger.kernel.org, "Bos, H.J." , Brian Johannesmeyer , Cristiano Giuffrida , linux1394-devel@lists.sourceforge.net, Mike Rapoport References: <20220331223601.902329-1-jakobkoschel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220331223601.902329-1-jakobkoschel@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,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 Hi, On Fri, Apr 01, 2022 at 12:36:01AM +0200, Jakob Koschel wrote: > When list_for_each_entry() completes the iteration over the whole list > without breaking the loop, the iterator value will be a bogus pointer > computed based on the head element. > > While it is safe to use the pointer to determine if it was computed > based on the head element, either with list_entry_is_head() or > &pos->member == head, using the iterator variable after the loop should > be avoided. > > In preparation to limit the scope of a list iterator to the list > traversal loop, use a dedicated pointer to point to the found element [1]. > > Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ [1] > Signed-off-by: Jakob Koschel > --- > drivers/firewire/core-transaction.c | 30 +++++++++++++++-------------- > drivers/firewire/sbp2.c | 13 +++++++------ > 2 files changed, 23 insertions(+), 20 deletions(-) I think it is a good catch. Reviewed-by: Takashi Sakamoto For the changes in firewire-core module: Tested-by: Takashi Sakamoto Unfortunately the activity for maintenance in Linux FireWire subsystem is quite low. No actions in past half a year. If the patch blocks further work to improve list implementation, I think it better to look for the other path to merge. Regards Takashi Sakamoto