qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] migration/block-dirty-bitmap: Silence coverity


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] migration/block-dirty-bitmap: Silence coverity CID 1390625
Date: Tue, 26 Mar 2019 12:29:02 +0000

On Fri, 16 Nov 2018 at 18:43, John Snow <address@hidden> wrote:
>
> Coverity warns that backing_bs() could give us a NULL pointer, which
> we then use without checking that it isn't.
>
> In our loop condition, we check bs && bs->drv as a point of habit, but
> by nature of the block graph, we cannot have null bs pointers here.
>
> This loop skips only implicit nodes, which always have children, so
> this loop should never encounter a null value.
>
> Tighten the loop condition to coax Coverity into dropping
> its false positive.
>
> Suggested-by: Stefan Hajnoczi <address@hidden>
> Signed-off-by: John Snow <address@hidden>

I've just noticed that Coverity is still warning about this
case -- did this patch get forgotten, or is it obsoleted by
a different approach?

(This is now one of just 5 coverity issues outstanding.)

> ---
>  migration/block-dirty-bitmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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);
>          }

thanks
-- PMM



reply via email to

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