From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-devel@nongnu.org
Cc: Jason Wang <jasowang@redhat.com>, armbru@redhat.com
Subject: Re: [PATCH v4 1/5] net: Clarify early exit condition
Date: Tue, 19 Jan 2021 10:08:03 -0600 [thread overview]
Message-ID: <689a713c-b190-aa77-106d-24ad8e3fc49e@redhat.com> (raw)
In-Reply-To: <7e1edd6a-dbdf-3c4c-4dfa-c181418d09bd@virtuozzo.com>
On 1/13/21 10:54 PM, Vladimir Sementsov-Ogievskiy wrote:
> 14.01.2021 01:10, Eric Blake wrote:
>> On first glance, the loop in qmp_query_rx_filter() has early return
>> paths that could leak any allocation of filter_list from a previous
>> iteration. But on closer inspection, it is obvious that all of the
>> early exits are guarded by has_name, and that the bulk of the loop
>> body can be executed at most once if the user is filtering by name,
>> thus, any early exit coincides with an empty list. Add asserts to
>> make this obvious.
>
> A bit simpler (for me :) observation:
>
> But on closer inspection, it is obvious that all of the early exits are
> guarded by has_name, and in case when has_name is true we leave the loop
s/in case//
> (by break) immediately after allocation and assigning filter_list for
> the first time.
Replacing my wording with this touched-up sentence is fine with me, if
Markus would like to tweak the queued commit to incorporate it.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2021-01-19 16:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-13 22:10 [PATCH v4 0/5] Common macros for QAPI list growth Eric Blake
2021-01-13 22:10 ` [PATCH v4 1/5] net: Clarify early exit condition Eric Blake
2021-01-14 4:54 ` Vladimir Sementsov-Ogievskiy
2021-01-19 16:08 ` Eric Blake [this message]
2021-01-13 22:10 ` [PATCH v4 2/5] qapi: A couple more QAPI_LIST_PREPEND() stragglers Eric Blake
2021-01-14 5:18 ` Vladimir Sementsov-Ogievskiy
2021-01-13 22:10 ` [PATCH v4 3/5] qapi: Introduce QAPI_LIST_APPEND Eric Blake
2021-01-14 12:59 ` Markus Armbruster
2021-01-13 22:10 ` [PATCH v4 4/5] qapi: Use QAPI_LIST_APPEND in trivial cases Eric Blake
2021-01-13 22:10 ` [PATCH v4 5/5] qapi: More complex uses of QAPI_LIST_APPEND Eric Blake
2021-01-14 13:08 ` Markus Armbruster
2021-01-26 9:31 ` Markus Armbruster
2021-01-27 18:12 ` Eric Blake
2021-01-28 7:45 ` Markus Armbruster
2021-02-05 17:13 ` Eric Blake
2021-01-14 13:15 ` [PATCH v4 0/5] Common macros for QAPI list growth Markus Armbruster
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=689a713c-b190-aa77-106d-24ad8e3fc49e@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=jasowang@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/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).