[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 34/62] migration: fix maybe-uninitialized warning
From: |
Paolo Bonzini |
Subject: |
[PULL 34/62] migration: fix maybe-uninitialized warning |
Date: |
Mon, 16 Dec 2019 17:28:18 +0100 |
From: Marc-André Lureau <address@hidden>
../migration/ram.c: In function ‘multifd_recv_thread’:
/home/elmarco/src/qq/include/qapi/error.h:165:5: error: ‘block’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
165 | error_setg_internal((errp), __FILE__, __LINE__, __func__, \
| ^~~~~~~~~~~~~~~~~~~
../migration/ram.c:818:15: note: ‘block’ was declared here
818 | RAMBlock *block;
| ^~~~~
Signed-off-by: Marc-André Lureau <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
migration/ram.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 5078f94..7dd7f81 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -864,15 +864,17 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams
*p, Error **errp)
p->next_packet_size = be32_to_cpu(packet->next_packet_size);
p->packet_num = be64_to_cpu(packet->packet_num);
- if (p->pages->used) {
- /* make sure that ramblock is 0 terminated */
- packet->ramblock[255] = 0;
- block = qemu_ram_block_by_name(packet->ramblock);
- if (!block) {
- error_setg(errp, "multifd: unknown ram block %s",
- packet->ramblock);
- return -1;
- }
+ if (p->pages->used == 0) {
+ return 0;
+ }
+
+ /* make sure that ramblock is 0 terminated */
+ packet->ramblock[255] = 0;
+ block = qemu_ram_block_by_name(packet->ramblock);
+ if (!block) {
+ error_setg(errp, "multifd: unknown ram block %s",
+ packet->ramblock);
+ return -1;
}
for (i = 0; i < p->pages->used; i++) {
--
1.8.3.1
- [PULL 25/62] tcg: add "-accel tcg,tb-size" and deprecate "-tb-size", (continued)
- [PULL 25/62] tcg: add "-accel tcg,tb-size" and deprecate "-tb-size", Paolo Bonzini, 2019/12/16
- [PULL 26/62] xen: convert "-machine igd-passthru" to an accelerator property, Paolo Bonzini, 2019/12/16
- [PULL 27/62] kvm: convert "-machine kvm_shadow_mem" to an accelerator property, Paolo Bonzini, 2019/12/16
- [PULL 30/62] Makefile: remove unused variables, Paolo Bonzini, 2019/12/16
- [PULL 28/62] kvm: introduce kvm_kernel_irqchip_* functions, Paolo Bonzini, 2019/12/16
- [PULL 29/62] kvm: convert "-machine kernel_irqchip" to an accelerator property, Paolo Bonzini, 2019/12/16
- [PULL 31/62] object: Improve documentation of interfaces, Paolo Bonzini, 2019/12/16
- [PULL 32/62] build-sys: build vhost-user-gpu only if CONFIG_TOOLS, Paolo Bonzini, 2019/12/16
- [PULL 35/62] monitor: fix maybe-uninitialized, Paolo Bonzini, 2019/12/16
- [PULL 33/62] build-sys: do not include Windows SLIRP dependencies in $LIBS, Paolo Bonzini, 2019/12/16
- [PULL 34/62] migration: fix maybe-uninitialized warning,
Paolo Bonzini <=
- [PULL 36/62] vhost-user-scsi: fix printf format warning, Paolo Bonzini, 2019/12/16
- [PULL 37/62] os-posix: simplify os_find_datadir, Paolo Bonzini, 2019/12/16
- [PULL 38/62] tests: skip block layer tests if !CONFIG_TOOLS, Paolo Bonzini, 2019/12/16
- [PULL 39/62] libvixl: remove per-target compiler flags, Paolo Bonzini, 2019/12/16
- [PULL 40/62] crypto: move common bits for all emulators to libqemuutil, Paolo Bonzini, 2019/12/16
- [PULL 42/62] configure: set $PYTHON to a full path, Paolo Bonzini, 2019/12/16
- [PULL 41/62] stubs: replace stubs with lnot if applicable, Paolo Bonzini, 2019/12/16
- [PULL 44/62] i386: conditionally compile more files, Paolo Bonzini, 2019/12/16
- [PULL 43/62] configure: simplify vhost condition with Kconfig, Paolo Bonzini, 2019/12/16
- [PULL 45/62] fw_cfg: allow building without other devices, Paolo Bonzini, 2019/12/16