[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH] migration/block-dirty-bitmap: fix uninitialized variable war
From: |
Chenqun (kuhn) |
Subject: |
RE: [PATCH] migration/block-dirty-bitmap: fix uninitialized variable warning |
Date: |
Tue, 13 Oct 2020 07:27:56 +0000 |
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".
> >
Hi Laurent,
Yes, you're right. It will be modified value when cancel_incoming_locked is
executed.
Thanks.
> So I think this can simply assign 'bitmap_name' to NULL to make
> compiler happy.
>
Hi Qiang,
I think your suggestion is feasible.
But can we just give it a default value when defining variables?
I think the default value could be "bitmap_name = s->bitmap_alias",
and then we can delete the else statement above.
Thanks,
Chen Qun