Message ID | 20201014114430.1898684-1-kuhn.chenqun@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v3] migration/block-dirty-bitmap: fix uninitialized variable warning | expand |
14.10.2020 14:44, Chen Qun wrote: > A default value is provided for the variable 'bitmap_name' to avoid compiler warning. > > The compiler show 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> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Ping! Hello, Maybe this patch, some people have any other suggestions? Or, maybe missed to queue? Thanks, Chen Qun > -----Original Message----- > From: Vladimir Sementsov-Ogievskiy [mailto:vsementsov@virtuozzo.com] > Sent: Wednesday, October 14, 2020 11:56 PM > To: Chenqun (kuhn) <kuhn.chenqun@huawei.com>; qemu-devel@nongnu.org; > qemu-trivial@nongnu.org > Cc: mreitz@redhat.com; stefanha@redhat.com; fam@euphon.net; > eblake@redhat.com; jsnow@redhat.com; quintela@redhat.com; > dgilbert@redhat.com; Zhanghailiang <zhang.zhanghailiang@huawei.com>; > ganqixin <ganqixin@huawei.com>; qemu-block@nongnu.org; Euler Robot > <euler.robot@huawei.com>; Laurent Vivier <laurent@vivier.eu>; Li Qiang > <liq3ea@gmail.com> > Subject: Re: [PATCH v3] migration/block-dirty-bitmap: fix uninitialized variable > warning > > 14.10.2020 14:44, Chen Qun wrote: > > A default value is provided for the variable 'bitmap_name' to avoid compiler > warning. > > > > The compiler show 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> > > Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> > > -- > Best regards, > Vladimir
Le 20/10/2020 à 09:36, Chenqun (kuhn) a écrit : > Ping! > > Hello, > > Maybe this patch, some people have any other suggestions? Or, maybe missed to queue? Hi, As we've seen by reviewing previous versions, this change is not really trivial, so I will not take it via the trivial queue. Perhaps via block I/O queue (Stefan?), Dirty Bitmaps (John?) or Migration (Juan?). Thanks, Laurent > Thanks, > Chen Qun > >> -----Original Message----- >> From: Vladimir Sementsov-Ogievskiy [mailto:vsementsov@virtuozzo.com] >> Sent: Wednesday, October 14, 2020 11:56 PM >> To: Chenqun (kuhn) <kuhn.chenqun@huawei.com>; qemu-devel@nongnu.org; >> qemu-trivial@nongnu.org >> Cc: mreitz@redhat.com; stefanha@redhat.com; fam@euphon.net; >> eblake@redhat.com; jsnow@redhat.com; quintela@redhat.com; >> dgilbert@redhat.com; Zhanghailiang <zhang.zhanghailiang@huawei.com>; >> ganqixin <ganqixin@huawei.com>; qemu-block@nongnu.org; Euler Robot >> <euler.robot@huawei.com>; Laurent Vivier <laurent@vivier.eu>; Li Qiang >> <liq3ea@gmail.com> >> Subject: Re: [PATCH v3] migration/block-dirty-bitmap: fix uninitialized variable >> warning >> >> 14.10.2020 14:44, Chen Qun wrote: >>> A default value is provided for the variable 'bitmap_name' to avoid compiler >> warning. >>> >>> The compiler show 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> >> >> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> >> >> -- >> Best regards, >> Vladimir
20.10.2020 11:16, Laurent Vivier wrote: > Le 20/10/2020 à 09:36, Chenqun (kuhn) a écrit : >> Ping! >> >> Hello, >> >> Maybe this patch, some people have any other suggestions? Or, maybe missed to queue? > > Hi, > > As we've seen by reviewing previous versions, this change is not really > trivial, so I will not take it via the trivial queue. > > Perhaps via block I/O queue (Stefan?), Dirty Bitmaps (John?) or > Migration (Juan?). > Correct would be Eric's bitmaps tree. > >> Thanks, >> Chen Qun >> >>> -----Original Message----- >>> From: Vladimir Sementsov-Ogievskiy [mailto:vsementsov@virtuozzo.com] >>> Sent: Wednesday, October 14, 2020 11:56 PM >>> To: Chenqun (kuhn) <kuhn.chenqun@huawei.com>; qemu-devel@nongnu.org; >>> qemu-trivial@nongnu.org >>> Cc: mreitz@redhat.com; stefanha@redhat.com; fam@euphon.net; >>> eblake@redhat.com; jsnow@redhat.com; quintela@redhat.com; >>> dgilbert@redhat.com; Zhanghailiang <zhang.zhanghailiang@huawei.com>; >>> ganqixin <ganqixin@huawei.com>; qemu-block@nongnu.org; Euler Robot >>> <euler.robot@huawei.com>; Laurent Vivier <laurent@vivier.eu>; Li Qiang >>> <liq3ea@gmail.com> >>> Subject: Re: [PATCH v3] migration/block-dirty-bitmap: fix uninitialized variable >>> warning >>> >>> 14.10.2020 14:44, Chen Qun wrote: >>>> A default value is provided for the variable 'bitmap_name' to avoid compiler >>> warning. >>>> >>>> The compiler show 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> >>> >>> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> >>> >>> -- >>> Best regards, >>> Vladimir >
On 10/20/20 5:39 AM, Vladimir Sementsov-Ogievskiy wrote: > 20.10.2020 11:16, Laurent Vivier wrote: >> Le 20/10/2020 à 09:36, Chenqun (kuhn) a écrit : >>> Ping! >>> >>> Hello, >>> >>> Maybe this patch, some people have any other suggestions? Or, >>> maybe missed to queue? >> >> Hi, >> >> As we've seen by reviewing previous versions, this change is not really >> trivial, so I will not take it via the trivial queue. >> >> Perhaps via block I/O queue (Stefan?), Dirty Bitmaps (John?) or >> Migration (Juan?). >> > > Correct would be Eric's bitmaps tree. Yes, I'm planning on queuing this.
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index 5bef793ac0..114987961a 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -1071,18 +1071,15 @@ static int dirty_bitmap_load_header(QEMUFile *f, DBMLoadState *s, return -EINVAL; } - if (!s->cancelled) { - if (bitmap_alias_map) { - bitmap_name = g_hash_table_lookup(bitmap_alias_map, - s->bitmap_alias); - if (!bitmap_name) { - error_report("Error: Unknown bitmap alias '%s' on node " - "'%s' (alias '%s')", s->bitmap_alias, - s->bs->node_name, s->node_alias); - cancel_incoming_locked(s); - } - } else { - bitmap_name = s->bitmap_alias; + bitmap_name = s->bitmap_alias; + if (!s->cancelled && bitmap_alias_map) { + bitmap_name = g_hash_table_lookup(bitmap_alias_map, + s->bitmap_alias); + if (!bitmap_name) { + error_report("Error: Unknown bitmap alias '%s' on node " + "'%s' (alias '%s')", s->bitmap_alias, + s->bs->node_name, s->node_alias); + cancel_incoming_locked(s); } }
A default value is provided for the variable 'bitmap_name' to avoid compiler warning. The compiler show 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> --- v2->v3: Placing the declaration at the beginning of the block(Base on Max's suggestion). Cc: Max Reitz <mreitz@redhat.com> Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Cc: Laurent Vivier <laurent@vivier.eu> Cc: Li Qiang <liq3ea@gmail.com> --- migration/block-dirty-bitmap.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)