[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/11] migration: fix uninitialized variable warning in migrate_se
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 04/11] migration: fix uninitialized variable warning in migrate_send_rp_req_pages() |
Date: |
Thu, 12 Nov 2020 18:37:51 +0000 |
From: Chen Qun <kuhn.chenqun@huawei.com>
After the WITH_QEMU_LOCK_GUARD macro is added, the compiler cannot identify
that the statements in the macro must be executed. As a result, some variables
assignment statements in the macro may be considered as unexecuted by the
compiler.
When the -Wmaybe-uninitialized capability is enabled on GCC9,the compiler
showed warning:
migration/migration.c: In function ‘migrate_send_rp_req_pages’:
migration/migration.c:384:8: warning: ‘received’ may be used uninitialized in
this function [-Wmaybe-uninitialized]
384 | if (received) {
| ^
Add a default value for 'received' to prevented the warning.
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201111142203.2359370-6-kuhn.chenqun@huawei.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/migration.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/migration/migration.c b/migration/migration.c
index 3263aa55a9..f696e22fab 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -365,7 +365,7 @@ int migrate_send_rp_req_pages(MigrationIncomingState *mis,
RAMBlock *rb, ram_addr_t start, uint64_t haddr)
{
void *aligned = (void *)(uintptr_t)(haddr & (-qemu_ram_pagesize(rb)));
- bool received;
+ bool received = false;
WITH_QEMU_LOCK_GUARD(&mis->page_request_mutex) {
received = ramblock_recv_bitmap_test_byte_offset(rb, start);
--
2.28.0
- [PULL 00/11] migration queue, Dr. David Alan Gilbert (git), 2020/11/12
- [PULL 01/11] migration/ram: Fix hexadecimal format string specifier, Dr. David Alan Gilbert (git), 2020/11/12
- [PULL 02/11] ACPI: Avoid infinite recursion when dump-vmstate, Dr. David Alan Gilbert (git), 2020/11/12
- [PULL 03/11] migration/multifd: fix hangup with TLS-Multifd due to blocking handshake, Dr. David Alan Gilbert (git), 2020/11/12
- [PULL 04/11] migration: fix uninitialized variable warning in migrate_send_rp_req_pages(),
Dr. David Alan Gilbert (git) <=
- [PULL 05/11] migration/dirtyrate: simplify includes in dirtyrate.c, Dr. David Alan Gilbert (git), 2020/11/12
- [PULL 06/11] multifd/tls: fix memoryleak of the QIOChannelSocket object when cancelling migration, Dr. David Alan Gilbert (git), 2020/11/12
- [PULL 08/11] virtiofsd: Announce submounts even without statx(), Dr. David Alan Gilbert (git), 2020/11/12
- [PULL 07/11] migration: handle CANCELLING state in migration_completion(), Dr. David Alan Gilbert (git), 2020/11/12
- [PULL 09/11] tools/virtiofsd/buffer.c: check whether buf is NULL in fuse_bufvec_advance func, Dr. David Alan Gilbert (git), 2020/11/12
- [PULL 10/11] virtiofsd: check whether lo_map_reserve returns NULL in, main func, Dr. David Alan Gilbert (git), 2020/11/12
- [PULL 11/11] virtiofsd: check whether strdup lo.source return NULL in main func, Dr. David Alan Gilbert (git), 2020/11/12
- Re: [PULL 00/11] migration queue, Peter Maydell, 2020/11/13