From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Jakob Koschel <jakobkoschel@gmail.com>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>,
linux-kernel@vger.kernel.org, "Bos, H.J." <h.j.bos@vu.nl>,
Brian Johannesmeyer <bjohannesmeyer@gmail.com>,
Cristiano Giuffrida <c.giuffrida@vu.nl>,
linux1394-devel@lists.sourceforge.net,
Mike Rapoport <rppt@kernel.org>
Subject: Re: [PATCH] firewire: remove check of list iterator against head past the loop body
Date: Sun, 3 Apr 2022 14:02:47 +0900 [thread overview]
Message-ID: <YkkqdybZovAITy6k@workstation> (raw)
In-Reply-To: <20220331223601.902329-1-jakobkoschel@gmail.com>
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 <jakobkoschel@gmail.com>
> ---
> 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 <o-takashi@sakamocchi.jp>
For the changes in firewire-core module:
Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
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
prev parent reply other threads:[~2022-04-03 5:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-31 22:36 [PATCH] firewire: remove check of list iterator against head past the loop body Jakob Koschel
2022-04-03 5:02 ` Takashi Sakamoto [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YkkqdybZovAITy6k@workstation \
--to=o-takashi@sakamocchi.jp \
--cc=bjohannesmeyer@gmail.com \
--cc=c.giuffrida@vu.nl \
--cc=h.j.bos@vu.nl \
--cc=jakobkoschel@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=rppt@kernel.org \
--cc=stefanr@s5r6.in-berlin.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).