[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH for-2.10] block/qapi: Remove redund

From: Kevin Wolf
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH for-2.10] block/qapi: Remove redundat NULL check to silence Coverity
Date: Mon, 31 Jul 2017 17:13:00 +0200
User-agent: Mutt/1.8.3 (2017-05-23)

Am 31.07.2017 um 16:54 hat Philippe Mathieu-Daudé geschrieben:
> On 07/31/2017 11:38 AM, Jeff Cody wrote:
> > On Mon, Jul 31, 2017 at 02:51:11PM +0200, Kevin Wolf wrote:
> > > When skipping implicit nodes in bdrv_block_device_info(), we know that
> > > bs0 is always non-NULL; initially, because it's taken from a BdrvChild
> > 
> > Not to mention, we deference bs0 in the chunk of code right above this, so
> > we'd segfault anyway if the initial value was NULL.

Not really. The last use of bs0 before the loop is:

    bs0 = bs0->backing->bs;bs0 = bs0->backing->bs;

So we're pointing to a different BDS now.

> Yes, please move your assert before:
> 137:    if (bs0->drv && bs0->backing) {

That would assert something completely different and much more obvious.
(And apart from that, bdrv_query_image_info() in line 130 already
dereferences bs0, so it would be too late, too.)

What I want to assert here is that every implicit image has a backing


reply via email to

[Prev in Thread] Current Thread [Next in Thread]