From: John Snow <jsnow@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>,
Stefan Hajnoczi <stefanha@gmail.com>
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Qemu-block <qemu-block@nongnu.org>, Fam Zheng <famz@redhat.com>,
Juan Quintela <quintela@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
"Denis V. Lunev" <den@openvz.org>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] migration/block-dirty-bitmap: fix Coverity CID1390625
Date: Thu, 15 Nov 2018 22:28:48 -0500 [thread overview]
Message-ID: <97c6b0f3-da95-7c99-c478-303544c2990b@redhat.com> (raw)
In-Reply-To: <CAFEAcA_h8pWjNokWQqUXqLDS=WrtKz-zKQ4QjhjV5UR2Yb8MbQ@mail.gmail.com>
On 11/15/18 6:48 AM, Peter Maydell wrote:
> On 17 October 2018 at 10:51, Stefan Hajnoczi <stefanha@gmail.com> wrote:
>> On Tue, Oct 16, 2018 at 04:20:18PM +0300, Vladimir Sementsov-Ogievskiy wrote:
>>> Theoretically possible that we finish the skipping loop with bs = NULL
>>> and the following code will crash trying to dereference it. Fix that.
>>>
>>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>>> ---
>>> migration/block-dirty-bitmap.c | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
>>> index 477826330c..6de808f95f 100644
>>> --- a/migration/block-dirty-bitmap.c
>>> +++ b/migration/block-dirty-bitmap.c
>>> @@ -288,6 +288,10 @@ static int init_dirty_bitmap_migration(void)
>>> bs = backing_bs(bs);
>>> }
>>>
>>> + if (!bs || bs->implicit) {
>>> + continue;
>>> + }
>>> +
>>> for (bitmap = bdrv_dirty_bitmap_next(bs, NULL); bitmap;
>>> bitmap = bdrv_dirty_bitmap_next(bs, bitmap))
>>> {
>>
>> Previous discussion:
>> http://qemu.11.n7.nabble.com/PATCH-migration-Appease-coverity-skip-empty-block-trees-td582504.html
>>
>> I've CCed John so he can take a look.
>
> So have you block-layer folks figured out how you want to address
> this Coverity issue yet?
>
> thanks
> -- PMM
>
I looked again. I think Vladimir's patch will shut up Coverity for sure,
feel free to apply it if you want this out of your hair.
Stefan suggests the following, however;
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index 5e90f44c2f..00c068fda3 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -284,7 +284,7 @@ static int init_dirty_bitmap_migration(void)
const char *drive_name = bdrv_get_device_or_node_name(bs);
/* skip automatically inserted nodes */
- while (bs && bs->drv && bs->implicit) {
+ while (bs->drv && bs->implicit) {
bs = backing_bs(bs);
}
that by removing the assumption that bs could ever be null here (it
shouldn't), that we'll coax coverity into not warning anymore. I don't
know if that will work, because backing_bs can theoretically return NULL
and might convince coverity there's a problem. In practice it won't be.
I don't know how to check this to see if Stefan's suggestion is appropriate.
For such a small, trivial issue though, just merge this and be done with
it, in my opinion. If you want to take this fix directly as a "build
fix" I wouldn't object.
I'm sorry for the fuss.
next prev parent reply other threads:[~2018-11-16 3:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-16 13:20 [Qemu-devel] [PATCH] migration/block-dirty-bitmap: fix Coverity CID1390625 Vladimir Sementsov-Ogievskiy
2018-10-17 9:51 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2018-11-15 11:48 ` Peter Maydell
2018-11-15 16:42 ` John Snow
2018-11-16 3:28 ` John Snow [this message]
2018-11-16 10:04 ` Peter Maydell
2018-11-16 16:16 ` John Snow
2018-11-16 16:49 ` Peter Maydell
2018-11-16 14:29 ` [Qemu-devel] " Stefan Hajnoczi
2018-11-19 11:55 ` Vladimir Sementsov-Ogievskiy
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=97c6b0f3-da95-7c99-c478-303544c2990b@redhat.com \
--to=jsnow@redhat.com \
--cc=den@openvz.org \
--cc=dgilbert@redhat.com \
--cc=famz@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@gmail.com \
--cc=stefanha@redhat.com \
--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).