From: Jens Axboe <axboe@kernel.dk>
To: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>,
"Jakob Koschel" <jakobkoschel@gmail.com>
Cc: linux-kernel@vger.kernel.org, "Bos, H.J." <h.j.bos@vu.nl>,
Brian Johannesmeyer <bjohannesmeyer@gmail.com>,
linux-block@vger.kernel.org,
Cristiano Giuffrida <c.giuffrida@vu.nl>,
Lars Ellenberg <lars.ellenberg@linbit.com>,
Mike Rapoport <rppt@kernel.org>,
drbd-dev@lists.linbit.com,
Philipp Reisner <philipp.reisner@linbit.com>
Subject: Re: [Drbd-dev] [PATCH 2/2] drbd: remove check of list iterator against head past the loop body
Date: Thu, 31 Mar 2022 17:09:51 -0600 [thread overview]
Message-ID: <078e8084-8fea-5b69-89a6-9488a28163cf@kernel.dk> (raw)
In-Reply-To: <4dcedb78-355f-ed1a-9af1-27e9e63b5643@linbit.com>
On 3/31/22 4:28 PM, Christoph B?hmwalder wrote:
> Am 01.04.22 um 00:03 schrieb Jakob Koschel:
>> 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].
>>
>
> Hi Jakob,
>
> Both of these look good to me, thanks.
>
> Reviewed-by: Christoph B?hmwalder <christoph.boehmwalder@linbit.com>
Applied both, but shortened title of this commit. Jakob, please keep it
within the usual 74 chars. In general, it's great to use a cover letter
for anything that's more than one patch. Just some pointers if you're
doing more of these.
--
Jens Axboe
next prev parent reply other threads:[~2022-03-31 23:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-31 22:03 [PATCH 1/2] drbd: remove usage of list iterator variable after loop for list_for_each_entry_safe_from() Jakob Koschel
2022-03-31 22:03 ` [PATCH 2/2] drbd: remove check of list iterator against head past the loop body Jakob Koschel
2022-03-31 22:28 ` [Drbd-dev] " Christoph Böhmwalder
2022-03-31 23:09 ` Jens Axboe [this message]
2022-04-01 23:56 ` [PATCH 1/2] drbd: remove usage of list iterator variable after loop for list_for_each_entry_safe_from() Jens Axboe
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=078e8084-8fea-5b69-89a6-9488a28163cf@kernel.dk \
--to=axboe@kernel.dk \
--cc=bjohannesmeyer@gmail.com \
--cc=c.giuffrida@vu.nl \
--cc=christoph.boehmwalder@linbit.com \
--cc=drbd-dev@lists.linbit.com \
--cc=h.j.bos@vu.nl \
--cc=jakobkoschel@gmail.com \
--cc=lars.ellenberg@linbit.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=philipp.reisner@linbit.com \
--cc=rppt@kernel.org \
/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
all inboxes | Powered by JetHome®