[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <078e8084-8fea-5b69-89a6-9488a28163cf@kernel.dk>
Date: Thu, 31 Mar 2022 17:09:51 -0600
From: Jens Axboe <axboe@...nel.dk>
To: Christoph Böhmwalder
<christoph.boehmwalder@...bit.com>,
Jakob Koschel <jakobkoschel@...il.com>
Cc: linux-kernel@...r.kernel.org, "Bos, H.J." <h.j.bos@...nl>,
Brian Johannesmeyer <bjohannesmeyer@...il.com>,
linux-block@...r.kernel.org,
Cristiano Giuffrida <c.giuffrida@...nl>,
Lars Ellenberg <lars.ellenberg@...bit.com>,
Mike Rapoport <rppt@...nel.org>, drbd-dev@...ts.linbit.com,
Philipp Reisner <philipp.reisner@...bit.com>
Subject: Re: [Drbd-dev] [PATCH 2/2] drbd: remove check of list iterator
against head past the loop body
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@...bit.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
Powered by blists - more mailing lists