From: Laurent Vivier <laurent@vivier.eu>
To: Chen Qun <kuhn.chenqun@huawei.com>,
	qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Cc: fam@euphon.net, vsementsov@virtuozzo.com,
	zhang.zhanghailiang@huawei.com, qemu-block@nongnu.org,
	quintela@redhat.com, jsnow@redhat.com, stefanha@redhat.com,
	dgilbert@redhat.com, mreitz@redhat.com, ganqixin@huawei.com,
	Euler Robot <euler.robot@huawei.com>
Subject: Re: [PATCH] migration/block-dirty-bitmap: fix uninitialized variable warning
Date: Mon, 12 Oct 2020 17:31:36 +0200	[thread overview]
Message-ID: <2b2bc826-0785-66e2-3515-b98abfac26ca@vivier.eu> (raw)
In-Reply-To: <20201010110730.1575180-1-kuhn.chenqun@huawei.com>
Le 10/10/2020 à 13:07, Chen Qun a écrit :
> This if statement judgment is redundant and it will cause a warning:
> 
> migration/block-dirty-bitmap.c:1090:13: warning: ‘bitmap_name’ may be used
>  uninitialized in this function [-Wmaybe-uninitialized]
>              g_strlcpy(s->bitmap_name, bitmap_name, sizeof(s->bitmap_name));
>              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
>  migration/block-dirty-bitmap.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
> index 5bef793ac0..e09ea4f22b 100644
> --- a/migration/block-dirty-bitmap.c
> +++ b/migration/block-dirty-bitmap.c
> @@ -1084,9 +1084,7 @@ static int dirty_bitmap_load_header(QEMUFile *f, DBMLoadState *s,
>              } else {
>                  bitmap_name = s->bitmap_alias;
>              }
> -        }
>  
> -        if (!s->cancelled) {
>              g_strlcpy(s->bitmap_name, bitmap_name, sizeof(s->bitmap_name));
>              s->bitmap = bdrv_find_dirty_bitmap(s->bs, s->bitmap_name);
>  
> 
I don't think it's correct as "cancel_incoming_locked(s)" can change the
value of "s->cancelled".
Thanks,
Laurent
next prev parent reply	other threads:[~2020-10-12 15:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-10 11:07 [PATCH] migration/block-dirty-bitmap: fix uninitialized variable warning Chen Qun
2020-10-11  1:55 ` Li Qiang
2020-10-12 15:31 ` Laurent Vivier [this message]
2020-10-13  1:34   ` Li Qiang
2020-10-13  7:11     ` Laurent Vivier
2020-10-13  7:49       ` Chenqun (kuhn)
2020-10-13 11:32         ` Vladimir Sementsov-Ogievskiy
2020-10-13 11:49           ` Chenqun (kuhn)
2020-10-13  7:27     ` Chenqun (kuhn)
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=2b2bc826-0785-66e2-3515-b98abfac26ca@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=dgilbert@redhat.com \
    --cc=euler.robot@huawei.com \
    --cc=fam@euphon.net \
    --cc=ganqixin@huawei.com \
    --cc=jsnow@redhat.com \
    --cc=kuhn.chenqun@huawei.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@virtuozzo.com \
    --cc=zhang.zhanghailiang@huawei.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).