From d0e31a105e2a353a2ac148c8f0044cfa8939f645 Mon Sep 17 00:00:00 2001 From: Ishani Chugh Date: Thu, 13 Apr 2017 21:44:39 +0530 Subject: [PATCH 01/23] Remove reduntant qemu: from error functions This patch removes redundant "qemu:" from error functions. The link to the bitesized task is: http://wiki.qemu-project.org/Contribute/BiteSizedTasks#Error_checking Signed-off-by: Ishani Chugh Reviewed-by: Eduardo Habkost Reviewed-by: David Gibson Signed-off-by: Michael Tokarev --- hw/microblaze/boot.c | 2 +- hw/nios2/boot.c | 2 +- hw/ppc/pnv.c | 2 +- hw/s390x/sclp.c | 4 ++-- hw/tricore/tricore_testboard.c | 2 +- numa.c | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index 1834d22a61..457a08a2fe 100644 --- a/hw/microblaze/boot.c +++ b/hw/microblaze/boot.c @@ -189,7 +189,7 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base, ram_size - initrd_offset); } if (initrd_size < 0) { - error_report("qemu: could not load initrd '%s'", + error_report("could not load initrd '%s'", initrd_filename); exit(EXIT_FAILURE); } diff --git a/hw/nios2/boot.c b/hw/nios2/boot.c index e0a9aff2f4..2b31f5b844 100644 --- a/hw/nios2/boot.c +++ b/hw/nios2/boot.c @@ -197,7 +197,7 @@ void nios2_load_kernel(Nios2CPU *cpu, hwaddr ddr_base, ram_size - initrd_offset); } if (initrd_size < 0) { - error_report("qemu: could not load initrd '%s'", + error_report("could not load initrd '%s'", initrd_filename); exit(EXIT_FAILURE); } diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index d4bcdb027f..6a498565c7 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -610,7 +610,7 @@ static void ppc_powernv_init(MachineState *machine) /* Create the processor chips */ chip_typename = g_strdup_printf(TYPE_PNV_CHIP "-%s", machine->cpu_model); if (!object_class_by_name(chip_typename)) { - error_report("qemu: invalid CPU model '%s' for %s machine", + error_report("invalid CPU model '%s' for %s machine", machine->cpu_model, MACHINE_GET_CLASS(machine)->name); exit(1); } diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index e741da1141..6996088584 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -496,10 +496,10 @@ static void sclp_realize(DeviceState *dev, Error **errp) ret = s390_set_memory_limit(machine->maxram_size, &hw_limit); if (ret == -E2BIG) { - error_setg(&err, "qemu: host supports a maximum of %" PRIu64 " GB", + error_setg(&err, "host supports a maximum of %" PRIu64 " GB", hw_limit >> 30); } else if (ret) { - error_setg(&err, "qemu: setting the guest size failed"); + error_setg(&err, "setting the guest size failed"); } out: diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c index 19dd587207..8910bf0f27 100644 --- a/hw/tricore/tricore_testboard.c +++ b/hw/tricore/tricore_testboard.c @@ -50,7 +50,7 @@ static void tricore_load_kernel(CPUTriCoreState *env) NULL, 0, EM_TRICORE, 1, 0); if (kernel_size <= 0) { - error_report("qemu: no kernel file '%s'", + error_report("no kernel file '%s'", tricoretb_binfo.kernel_filename); exit(1); } diff --git a/numa.c b/numa.c index 6fc2393ddd..39b743bd94 100644 --- a/numa.c +++ b/numa.c @@ -174,7 +174,7 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp) } if (node->has_mem && node->has_memdev) { - error_setg(errp, "qemu: cannot specify both mem= and memdev="); + error_setg(errp, "cannot specify both mem= and memdev="); return; } @@ -182,7 +182,7 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp) have_memdevs = node->has_memdev; } if (node->has_memdev != have_memdevs) { - error_setg(errp, "qemu: memdev option must be specified for either " + error_setg(errp, "memdev option must be specified for either " "all or no nodes"); return; } From 2d812d6dff5267d80c54125f15a090539573d29e Mon Sep 17 00:00:00 2001 From: KONRAD Frederic Date: Fri, 24 Mar 2017 13:55:47 +0100 Subject: [PATCH 02/23] ppc_booke: drop useless assignment The tb_env variable is set two lines above. So just drop the double assignment. Signed-off-by: KONRAD Frederic Reviewed-by: Laurent Vivier Signed-off-by: Michael Tokarev --- hw/ppc/ppc_booke.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c index 60baffaf1d..23bcf1b138 100644 --- a/hw/ppc/ppc_booke.c +++ b/hw/ppc/ppc_booke.c @@ -282,7 +282,6 @@ void store_booke_tcr(CPUPPCState *env, target_ulong val) ppc_tb_t *tb_env = env->tb_env; booke_timer_t *booke_timer = tb_env->opaque; - tb_env = env->tb_env; env->spr[SPR_BOOKE_TCR] = val; kvmppc_set_tcr(cpu); From 61f7c6a0c200db3749f131ff023fa50e7f71814e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 22 Mar 2017 15:52:41 +0400 Subject: [PATCH 03/23] doc: fix function spelling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi Signed-off-by: Michael Tokarev --- include/io/channel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/io/channel.h b/include/io/channel.h index 5d48906998..db9bb022a1 100644 --- a/include/io/channel.h +++ b/include/io/channel.h @@ -315,7 +315,7 @@ ssize_t qio_channel_read(QIOChannel *ioc, Error **errp); /** - * qio_channel_writev: + * qio_channel_write: * @ioc: the channel object * @buf: the memory regions to send data from * @buflen: the length of @buf From ed1fcd00094cdd9395315068442abe28f612e8a3 Mon Sep 17 00:00:00 2001 From: Craig Jellick Date: Fri, 17 Mar 2017 08:49:55 -0700 Subject: [PATCH 04/23] Add 'none' as type for drive's if option Signed-off-by: Craig Jellick Reviewed-by: Stefan Hajnoczi Signed-off-by: Michael Tokarev --- qemu-options.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-options.hx b/qemu-options.hx index f68829f3b0..a24fef2107 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -604,7 +604,7 @@ Special files such as iSCSI devices can be specified using protocol specific URLs. See the section for "Device URL Syntax" for more information. @item if=@var{interface} This option defines on which type on interface the drive is connected. -Available types are: ide, scsi, sd, mtd, floppy, pflash, virtio. +Available types are: ide, scsi, sd, mtd, floppy, pflash, virtio, none. @item bus=@var{bus},unit=@var{unit} These options define where is connected the drive by defining the bus number and the unit id. From 46bbbec2d30c3d791a6d328e5ef861694ff3eafb Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 8 Mar 2017 09:15:44 -0600 Subject: [PATCH 05/23] tests: Ignore more test executables Ignore test executables when building in-tree: test-arm-mptimer introduced in commit 882fac3 test-crypto-hmac introduced in commit 4fd460b test-aio-multithread introduced in commit 0c330a7 Signed-off-by: Eric Blake Reviewed-by: Laurent Vivier Signed-off-by: Michael Tokarev --- tests/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/.gitignore b/tests/.gitignore index a966740c2c..5ab00a9c95 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -11,6 +11,8 @@ check-qom-proplist qht-bench rcutorture test-aio +test-aio-multithread +test-arm-mptimer test-base64 test-bitops test-bitcnt @@ -24,6 +26,7 @@ test-crypto-afsplit test-crypto-block test-crypto-cipher test-crypto-hash +test-crypto-hmac test-crypto-ivgen test-crypto-pbkdf test-crypto-secret From 6b1de1484ee2f80d5795358ea79e90c3ceb64167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Fri, 7 Apr 2017 19:20:13 -0300 Subject: [PATCH 06/23] usb-ccid: make ccid_write_data_block() cope with null buffers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit static code analyzer complain: hw/usb/dev-smartcard-reader.c:816:5: warning: Null pointer passed as an argument to a 'nonnull' parameter memcpy(p->abData, data, len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Michael Tokarev --- hw/usb/dev-smartcard-reader.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index 757b8b3f5a..49cb1829b5 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -813,7 +813,10 @@ static void ccid_write_data_block(USBCCIDState *s, uint8_t slot, uint8_t seq, if (p->b.bError) { DPRINTF(s, D_VERBOSE, "error %d\n", p->b.bError); } - memcpy(p->abData, data, len); + if (len) { + g_assert_nonnull(data); + memcpy(p->abData, data, len); + } ccid_reset_error_status(s); usb_wakeup(s->bulk, 0); } From 21a9ad2f159e4cafd090cc2b47ce322e024c7363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Fri, 7 Apr 2017 19:20:14 -0300 Subject: [PATCH 07/23] device_tree: fix compiler warnings (clang 5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit static code analyzer complain: device_tree.c:155:18: warning: Null pointer passed as an argument to a 'nonnull' parameter while ((de = readdir(d)) != NULL) { ^~~~~~~~~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Marc-André Lureau Signed-off-by: Michael Tokarev --- device_tree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/device_tree.c b/device_tree.c index 6e06320830..a24ddff02b 100644 --- a/device_tree.c +++ b/device_tree.c @@ -148,6 +148,7 @@ static void read_fstree(void *fdt, const char *dirname) d = opendir(dirname); if (!d) { error_setg(&error_fatal, "%s cannot open %s", __func__, dirname); + return; } while ((de = readdir(d)) != NULL) { From 9879f5ac62c1e0c92a5ff2f4a0ada1b66d43da90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Fri, 7 Apr 2017 19:20:15 -0300 Subject: [PATCH 08/23] qga: fix compiler warnings (clang 5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit static code analyzer complain: qga/commands-posix.c:2127:9: warning: Null pointer passed as an argument to a 'nonnull' parameter closedir(dp); ^~~~~~~~~~~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Marc-André Lureau Reviewed-by: Michael Roth Signed-off-by: Michael Tokarev --- qga/commands-posix.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index ba06be4c86..284ecc6d7e 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -2125,9 +2125,11 @@ static void transfer_memory_block(GuestMemoryBlock *mem_blk, bool sys2memblk, * we think this VM does not support online/offline memory block, * any other solution? */ - if (!dp && errno == ENOENT) { - result->response = - GUEST_MEMORY_BLOCK_RESPONSE_TYPE_OPERATION_NOT_SUPPORTED; + if (!dp) { + if (errno == ENOENT) { + result->response = + GUEST_MEMORY_BLOCK_RESPONSE_TYPE_OPERATION_NOT_SUPPORTED; + } goto out1; } closedir(dp); From ec45bbe5f1921c6553fbf9c0c76b358b0403c22d Mon Sep 17 00:00:00 2001 From: Saurav Sachidanand Date: Mon, 20 Mar 2017 17:38:28 +0000 Subject: [PATCH 09/23] util: Use g_malloc/g_free in envlist.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change malloc/strdup/free to g_malloc/g_strdup/g_free in util/envlist.c. Remove NULL checks for pointers returned from g_malloc and g_strdup as they exit in case of failure. Also, update calls to envlist_create to reflect this. Free array and array contents returned by envlist_to_environ using g_free in bsd-user/main.c and linux-user/main.c. Update comments to reflect change in semantics. Signed-off-by: Saurav Sachidanand Reviewed-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Michael Tokarev --- bsd-user/main.c | 14 ++++---------- linux-user/main.c | 9 +++------ util/envlist.c | 47 +++++++++++++++++++---------------------------- 3 files changed, 26 insertions(+), 44 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 714a692e6f..04f95ddd54 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -744,10 +744,7 @@ int main(int argc, char **argv) qemu_init_cpu_list(); module_call_init(MODULE_INIT_QOM); - if ((envlist = envlist_create()) == NULL) { - (void) fprintf(stderr, "Unable to allocate envlist\n"); - exit(1); - } + envlist = envlist_create(); /* add current environment into the list */ for (wrk = environ; *wrk != NULL; wrk++) { @@ -785,10 +782,7 @@ int main(int argc, char **argv) usage(); } else if (!strcmp(r, "ignore-environment")) { envlist_free(envlist); - if ((envlist = envlist_create()) == NULL) { - (void) fprintf(stderr, "Unable to allocate envlist\n"); - exit(1); - } + envlist = envlist_create(); } else if (!strcmp(r, "U")) { r = argv[optind++]; if (envlist_unsetenv(envlist, r) != 0) @@ -956,10 +950,10 @@ int main(int argc, char **argv) } for (wrk = target_environ; *wrk; wrk++) { - free(*wrk); + g_free(*wrk); } - free(target_environ); + g_free(target_environ); if (qemu_loglevel_mask(CPU_LOG_PAGE)) { qemu_log("guest_base 0x%lx\n", guest_base); diff --git a/linux-user/main.c b/linux-user/main.c index 10a3bb3a12..5f20769cb9 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -4229,10 +4229,7 @@ int main(int argc, char **argv, char **envp) qemu_init_cpu_list(); module_call_init(MODULE_INIT_QOM); - if ((envlist = envlist_create()) == NULL) { - (void) fprintf(stderr, "Unable to allocate envlist\n"); - exit(EXIT_FAILURE); - } + envlist = envlist_create(); /* add current environment into the list */ for (wrk = environ; *wrk != NULL; wrk++) { @@ -4429,10 +4426,10 @@ int main(int argc, char **argv, char **envp) } for (wrk = target_environ; *wrk; wrk++) { - free(*wrk); + g_free(*wrk); } - free(target_environ); + g_free(target_environ); if (qemu_loglevel_mask(CPU_LOG_PAGE)) { qemu_log("guest_base 0x%lx\n", guest_base); diff --git a/util/envlist.c b/util/envlist.c index e86857e70a..1eeb7fca87 100644 --- a/util/envlist.c +++ b/util/envlist.c @@ -17,16 +17,14 @@ static int envlist_parse(envlist_t *envlist, const char *env, int (*)(envlist_t *, const char *)); /* - * Allocates new envlist and returns pointer to that or - * NULL in case of error. + * Allocates new envlist and returns pointer to it. */ envlist_t * envlist_create(void) { envlist_t *envlist; - if ((envlist = malloc(sizeof (*envlist))) == NULL) - return (NULL); + envlist = g_malloc(sizeof(*envlist)); QLIST_INIT(&envlist->el_entries); envlist->el_count = 0; @@ -48,10 +46,10 @@ envlist_free(envlist_t *envlist) entry = envlist->el_entries.lh_first; QLIST_REMOVE(entry, ev_link); - free((char *)entry->ev_var); - free(entry); + g_free((char *)entry->ev_var); + g_free(entry); } - free(envlist); + g_free(envlist); } /* @@ -101,8 +99,7 @@ envlist_parse(envlist_t *envlist, const char *env, if ((envlist == NULL) || (env == NULL)) return (EINVAL); - if ((tmpenv = strdup(env)) == NULL) - return (errno); + tmpenv = g_strdup(env); envsave = tmpenv; do { @@ -117,7 +114,7 @@ envlist_parse(envlist_t *envlist, const char *env, tmpenv = envvar + 1; } while (envvar != NULL); - free(envsave); + g_free(envsave); return ret; } @@ -155,18 +152,14 @@ envlist_setenv(envlist_t *envlist, const char *env) if (entry != NULL) { QLIST_REMOVE(entry, ev_link); - free((char *)entry->ev_var); - free(entry); + g_free((char *)entry->ev_var); + g_free(entry); } else { envlist->el_count++; } - if ((entry = malloc(sizeof (*entry))) == NULL) - return (errno); - if ((entry->ev_var = strdup(env)) == NULL) { - free(entry); - return (errno); - } + entry = g_malloc(sizeof(*entry)); + entry->ev_var = g_strdup(env); QLIST_INSERT_HEAD(&envlist->el_entries, entry, ev_link); return (0); @@ -201,8 +194,8 @@ envlist_unsetenv(envlist_t *envlist, const char *env) } if (entry != NULL) { QLIST_REMOVE(entry, ev_link); - free((char *)entry->ev_var); - free(entry); + g_free((char *)entry->ev_var); + g_free(entry); envlist->el_count--; } @@ -212,12 +205,12 @@ envlist_unsetenv(envlist_t *envlist, const char *env) /* * Returns given envlist as array of strings (in same form that * global variable environ is). Caller must free returned memory - * by calling free(3) for each element and for the array. Returned - * array and given envlist are not related (no common references). + * by calling g_free for each element and the array. + * Returned array and given envlist are not related (no common + * references). * * If caller provides count pointer, number of items in array is - * stored there. In case of error, NULL is returned and no memory - * is allocated. + * stored there. */ char ** envlist_to_environ(const envlist_t *envlist, size_t *count) @@ -225,13 +218,11 @@ envlist_to_environ(const envlist_t *envlist, size_t *count) struct envlist_entry *entry; char **env, **penv; - penv = env = malloc((envlist->el_count + 1) * sizeof (char *)); - if (env == NULL) - return (NULL); + penv = env = g_malloc((envlist->el_count + 1) * sizeof(char *)); for (entry = envlist->el_entries.lh_first; entry != NULL; entry = entry->ev_link.le_next) { - *(penv++) = strdup(entry->ev_var); + *(penv++) = g_strdup(entry->ev_var); } *penv = NULL; /* NULL terminate the list */ From 3c76c606dab4d2298a9877628fe28bf9e6d99e22 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Fri, 17 Mar 2017 10:17:39 +0800 Subject: [PATCH 10/23] block: Make 'replication_state' an enum BDRVReplicationState.replication_state is a name with a bit of duplication, plus it could be an enum like BDRVReplicationState.mode, which is more readable and also more straightforward in a debugger. Rename it, and improve the type while at it. Signed-off-by: Fam Zheng Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- block/replication.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/block/replication.c b/block/replication.c index d300c15475..3885f04c31 100644 --- a/block/replication.c +++ b/block/replication.c @@ -22,9 +22,17 @@ #include "qapi/error.h" #include "replication.h" +typedef enum { + BLOCK_REPLICATION_NONE, /* block replication is not started */ + BLOCK_REPLICATION_RUNNING, /* block replication is running */ + BLOCK_REPLICATION_FAILOVER, /* failover is running in background */ + BLOCK_REPLICATION_FAILOVER_FAILED, /* failover failed */ + BLOCK_REPLICATION_DONE, /* block replication is done */ +} ReplicationStage; + typedef struct BDRVReplicationState { ReplicationMode mode; - int replication_state; + ReplicationStage stage; BdrvChild *active_disk; BdrvChild *hidden_disk; BdrvChild *secondary_disk; @@ -36,14 +44,6 @@ typedef struct BDRVReplicationState { int error; } BDRVReplicationState; -enum { - BLOCK_REPLICATION_NONE, /* block replication is not started */ - BLOCK_REPLICATION_RUNNING, /* block replication is running */ - BLOCK_REPLICATION_FAILOVER, /* failover is running in background */ - BLOCK_REPLICATION_FAILOVER_FAILED, /* failover failed */ - BLOCK_REPLICATION_DONE, /* block replication is done */ -}; - static void replication_start(ReplicationState *rs, ReplicationMode mode, Error **errp); static void replication_do_checkpoint(ReplicationState *rs, Error **errp); @@ -141,10 +141,10 @@ static void replication_close(BlockDriverState *bs) { BDRVReplicationState *s = bs->opaque; - if (s->replication_state == BLOCK_REPLICATION_RUNNING) { + if (s->stage == BLOCK_REPLICATION_RUNNING) { replication_stop(s->rs, false, NULL); } - if (s->replication_state == BLOCK_REPLICATION_FAILOVER) { + if (s->stage == BLOCK_REPLICATION_FAILOVER) { block_job_cancel_sync(s->active_disk->bs->job); } @@ -174,7 +174,7 @@ static int64_t replication_getlength(BlockDriverState *bs) static int replication_get_io_status(BDRVReplicationState *s) { - switch (s->replication_state) { + switch (s->stage) { case BLOCK_REPLICATION_NONE: return -EIO; case BLOCK_REPLICATION_RUNNING: @@ -403,7 +403,7 @@ static void backup_job_completed(void *opaque, int ret) BlockDriverState *bs = opaque; BDRVReplicationState *s = bs->opaque; - if (s->replication_state != BLOCK_REPLICATION_FAILOVER) { + if (s->stage != BLOCK_REPLICATION_FAILOVER) { /* The backup job is cancelled unexpectedly */ s->error = -EIO; } @@ -445,7 +445,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode, aio_context_acquire(aio_context); s = bs->opaque; - if (s->replication_state != BLOCK_REPLICATION_NONE) { + if (s->stage != BLOCK_REPLICATION_NONE) { error_setg(errp, "Block replication is running or done"); aio_context_release(aio_context); return; @@ -545,7 +545,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode, abort(); } - s->replication_state = BLOCK_REPLICATION_RUNNING; + s->stage = BLOCK_REPLICATION_RUNNING; if (s->mode == REPLICATION_MODE_SECONDARY) { secondary_do_checkpoint(s, errp); @@ -581,7 +581,7 @@ static void replication_get_error(ReplicationState *rs, Error **errp) aio_context_acquire(aio_context); s = bs->opaque; - if (s->replication_state != BLOCK_REPLICATION_RUNNING) { + if (s->stage != BLOCK_REPLICATION_RUNNING) { error_setg(errp, "Block replication is not running"); aio_context_release(aio_context); return; @@ -601,7 +601,7 @@ static void replication_done(void *opaque, int ret) BDRVReplicationState *s = bs->opaque; if (ret == 0) { - s->replication_state = BLOCK_REPLICATION_DONE; + s->stage = BLOCK_REPLICATION_DONE; /* refresh top bs's filename */ bdrv_refresh_filename(bs); @@ -610,7 +610,7 @@ static void replication_done(void *opaque, int ret) s->hidden_disk = NULL; s->error = 0; } else { - s->replication_state = BLOCK_REPLICATION_FAILOVER_FAILED; + s->stage = BLOCK_REPLICATION_FAILOVER_FAILED; s->error = -EIO; } } @@ -625,7 +625,7 @@ static void replication_stop(ReplicationState *rs, bool failover, Error **errp) aio_context_acquire(aio_context); s = bs->opaque; - if (s->replication_state != BLOCK_REPLICATION_RUNNING) { + if (s->stage != BLOCK_REPLICATION_RUNNING) { error_setg(errp, "Block replication is not running"); aio_context_release(aio_context); return; @@ -633,7 +633,7 @@ static void replication_stop(ReplicationState *rs, bool failover, Error **errp) switch (s->mode) { case REPLICATION_MODE_PRIMARY: - s->replication_state = BLOCK_REPLICATION_DONE; + s->stage = BLOCK_REPLICATION_DONE; s->error = 0; break; case REPLICATION_MODE_SECONDARY: @@ -648,12 +648,12 @@ static void replication_stop(ReplicationState *rs, bool failover, Error **errp) if (!failover) { secondary_do_checkpoint(s, errp); - s->replication_state = BLOCK_REPLICATION_DONE; + s->stage = BLOCK_REPLICATION_DONE; aio_context_release(aio_context); return; } - s->replication_state = BLOCK_REPLICATION_FAILOVER; + s->stage = BLOCK_REPLICATION_FAILOVER; commit_active_start(NULL, s->active_disk->bs, s->secondary_disk->bs, BLOCK_JOB_INTERNAL, 0, BLOCKDEV_ON_ERROR_REPORT, NULL, replication_done, bs, true, errp); From bcd711feb0420d66e069498ed243a9e2b81ec167 Mon Sep 17 00:00:00 2001 From: "sochin.jiang" Date: Fri, 24 Mar 2017 22:28:25 +0800 Subject: [PATCH 11/23] channel-file: fix wrong parameter comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: sochin.jiang Reviewed-by: Marc-André Lureau Signed-off-by: Michael Tokarev --- include/io/channel-file.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/io/channel-file.h b/include/io/channel-file.h index d2462c2ed7..79245f1183 100644 --- a/include/io/channel-file.h +++ b/include/io/channel-file.h @@ -71,7 +71,7 @@ qio_channel_file_new_fd(int fd); /** * qio_channel_file_new_path: - * @fd: the file descriptor + * @path: the file path * @flags: the open flags (O_RDONLY|O_WRONLY|O_RDWR, etc) * @mode: the file creation mode if O_WRONLY is set in @flags * @errp: pointer to initialized error object From 09d352042fa91d296079e449c4d7fd6f42d5db05 Mon Sep 17 00:00:00 2001 From: Andreas Grapentin Date: Tue, 14 Mar 2017 17:59:53 +0100 Subject: [PATCH 12/23] use _Static_assert in QEMU_BUILD_BUG_ON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QEMU_BUILD_BUG_ON should use C11's _Static_assert, if the compiler supports it, to provide more readable messages on failure. We check for _Static_assert in configure, and set CONFIG_STATIC_ASSERT accordingly. QEMU_BUILD_BUG_ON invokes _Static_assert if CONFIG_STATIC_ASSERT is defined, and reverts to the old way otherwise. That way, systems without C11 conforming compiler will still have the old messages, as verified by intentionally breaking the configure check. the following example output was generated by inverting the condition in QEMU_BUILD_BUG_ON: without _Static_assert: > In file included from /qemu/include/qemu/osdep.h:36:0, > from /qemu/qga/commands.c:13: > /qemu/qga/commands.c: In function ‘qmp_guest_exec_status’: > /qemu/include/qemu/compiler.h:89:12: error: negative width in bit-field ‘’ > struct { \ > ^ > /qemu/include/qemu/compiler.h:96:38: note: in expansion of macro QEMU_BUILD_BUG_ON_STRUCT’ > #define QEMU_BUILD_BUG_ON(x) typedef QEMU_BUILD_BUG_ON_STRUCT(x) \ > ^~~~~~~~~~~~~~~~~~~~~~~~ > /qemu/include/qemu/atomic.h:146:5: note: in expansion of macro ‘QEMU_BUILD_BUG_ON’ > QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *)); \ > ^~~~~~~~~~~~~~~~~ > /qemu/include/qemu/atomic.h:417:5: note: in expansion of macro ‘atomic_load_acquire’ > atomic_load_acquire(ptr) > ^~~~~~~~~~~~~~~~~~~ > /qemu/qga/commands.c:160:21: note: in expansion of macro ‘atomic_mb_read’ > bool finished = atomic_mb_read(&gei->finished); > ^~~~~~~~~~~~~~ with _Static_assert: > In file included from /qemu/include/qemu/osdep.h:36:0, > from /qemu/qga/commands.c:13: > /qemu/qga/commands.c: In function ‘qmp_guest_exec_status’: > /qemu/include/qemu/compiler.h:94:30: error: static assertion failed: "not expecting: sizeof(*&gei->finished) > sizeof(void *)" > #define QEMU_BUILD_BUG_ON(x) _Static_assert(!(x), #x) > ^ > /qemu/include/qemu/atomic.h:146:5: note: in expansion of macro ‘QEMU_BUILD_BUG_ON’ > QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *)); \ > ^~~~~~~~~~~~~~~~~ > /qemu/include/qemu/atomic.h:417:5: note: in expansion of macro ‘atomic_load_acquire’ > atomic_load_acquire(ptr) > ^~~~~~~~~~~~~~~~~~~ > /qemu/qga/commands.c:160:21: note: in expansion of macro ‘atomic_mb_read’ > bool finished = atomic_mb_read(&gei->finished); > ^~~~~~~~~~~~~~ Signed-off-by: Andreas Grapentin Reviewed-by: Eric Blake Reviewed-by: Richard Henderson Signed-off-by: Michael Tokarev --- configure | 18 ++++++++++++++++++ include/qemu/compiler.h | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 48a9370cc6..39aadba813 100755 --- a/configure +++ b/configure @@ -4852,6 +4852,20 @@ EOF fi fi +########################################## +# check for _Static_assert() + +have_static_assert=no +cat > $TMPC << EOF +_Static_assert(1, "success"); +int main(void) { + return 0; +} +EOF +if compile_prog "" "" ; then + have_static_assert=yes +fi + ########################################## # End of CC checks # After here, no more $cc or $ld runs @@ -5848,6 +5862,10 @@ if test "$have_sysmacros" = "yes" ; then echo "CONFIG_SYSMACROS=y" >> $config_host_mak fi +if test "$have_static_assert" = "yes" ; then + echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak +fi + # Hold two types of flag: # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on # a thread we have a handle to diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index 18e610083a..340e5fdc09 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -82,7 +82,9 @@ int:(x) ? -1 : 1; \ } -#ifdef __COUNTER__ +#if defined(CONFIG_STATIC_ASSERT) +#define QEMU_BUILD_BUG_ON(x) _Static_assert(!(x), "not expecting: " #x) +#elif defined(__COUNTER__) #define QEMU_BUILD_BUG_ON(x) typedef QEMU_BUILD_BUG_ON_STRUCT(x) \ glue(qemu_build_bug_on__, __COUNTER__) __attribute__((unused)) #else From 3ba34a70223a78e89094c7f0a2f7cb6a667b8f9e Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 8 Mar 2017 13:13:25 +0100 Subject: [PATCH 13/23] qemu-doc: Fix broken URLs of amnhltm.zip and dosidle210.zip There are some broken URLs in the qemu-doc which reference tools that are not available at their original location anymore. Fortunately, they have been mirrored to archive.org, so point to that location instead. Signed-off-by: Thomas Huth Reviewed-by: Laurent Vivier Signed-off-by: Michael Tokarev --- qemu-doc.texi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qemu-doc.texi b/qemu-doc.texi index 794ab4a080..50411bc0ff 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -1878,8 +1878,8 @@ resolution modes which the Cirrus Logic BIOS does not support (i.e. >= Windows 9x does not correctly use the CPU HLT instruction. The result is that it takes host CPU cycles even when idle. You can install the utility from -@url{http://www.user.cityline.ru/~maxamn/amnhltm.zip} to solve this -problem. Note that no such tool is needed for NT, 2000 or XP. +@url{http://web.archive.org/web/20060212132151/http://www.user.cityline.ru/~maxamn/amnhltm.zip} +to solve this problem. Note that no such tool is needed for NT, 2000 or XP. @subsubsection Windows 2000 disk full problem @@ -1927,9 +1927,9 @@ vvfat block device ("-hdb fat:directory_which_holds_the_SP"). @subsubsection CPU usage reduction DOS does not correctly use the CPU HLT instruction. The result is that -it takes host CPU cycles even when idle. You can install the utility -from @url{http://www.vmware.com/software/dosidle210.zip} to solve this -problem. +it takes host CPU cycles even when idle. You can install the utility from +@url{http://web.archive.org/web/20051222085335/http://www.vmware.com/software/dosidle210.zip} +to solve this problem. @node QEMU System emulator for non PC targets @chapter QEMU System emulator for non PC targets From 1d29b5b0499c4d1f0415fadf94e41ed8964a7ed3 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Tue, 7 Feb 2017 21:27:22 +0800 Subject: [PATCH 14/23] virtio-blk: Remove useless condition around g_free() Laszlo spotted and studied this wasteful "if". He pointed out: The original virtio_blk_free_request needed an "if" as it accesses one field, since 671ec3f05655 ("virtio-blk: Convert VirtIOBlockReq.elem to pointer", 2014-06-11); later on in f897bf751fbd ("virtio-blk: embed VirtQueueElement in VirtIOBlockReq", 2014-07-09) the field became embedded, so the "if" became unnecessary (at which point we were using g_slice_free(), but it is the same. Now drop it. Reported-by: Laszlo Ersek Signed-off-by: Fam Zheng Reviewed-by: Laszlo Ersek Reviewed-by: Stefan Hajnoczi Signed-off-by: Michael Tokarev --- hw/block/virtio-blk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 98c16a7a9a..604d37dfc8 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -42,9 +42,7 @@ static void virtio_blk_init_request(VirtIOBlock *s, VirtQueue *vq, static void virtio_blk_free_request(VirtIOBlockReq *req) { - if (req) { - g_free(req); - } + g_free(req); } static void virtio_blk_req_complete(VirtIOBlockReq *req, unsigned char status) From 6516367fc0803d079384e0ad370856ac328bef30 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 25 Jan 2017 21:45:17 +0100 Subject: [PATCH 15/23] hw/core/generic-loader: Fix crash when running without CPU When running QEMU with "-M none -device loader,file=kernel.elf", it currently crashes with a segmentation fault, because the "none"-machine does not have any CPU by default and the generic loader code tries to dereference s->cpu. Fix it by adding an appropriate check for a NULL pointer. Reported-by: Laurent Vivier Signed-off-by: Thomas Huth Reviewed-by: Laurent Vivier Reviewed-by: Alistair Francis Signed-off-by: Michael Tokarev --- hw/core/generic-loader.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c index 58f1f02902..46012673c3 100644 --- a/hw/core/generic-loader.c +++ b/hw/core/generic-loader.c @@ -137,20 +137,21 @@ static void generic_loader_realize(DeviceState *dev, Error **errp) #endif if (s->file) { + AddressSpace *as = s->cpu ? s->cpu->as : NULL; + if (!s->force_raw) { size = load_elf_as(s->file, NULL, NULL, &entry, NULL, NULL, - big_endian, 0, 0, 0, s->cpu->as); + big_endian, 0, 0, 0, as); if (size < 0) { size = load_uimage_as(s->file, &entry, NULL, NULL, NULL, NULL, - s->cpu->as); + as); } } if (size < 0 || s->force_raw) { /* Default to the maximum size being the machine's ram size */ - size = load_image_targphys_as(s->file, s->addr, ram_size, - s->cpu->as); + size = load_image_targphys_as(s->file, s->addr, ram_size, as); } else { s->addr = entry; } From 3baa0a6a658e3a17a79d95440e5c949b2b13bb6e Mon Sep 17 00:00:00 2001 From: Chris Webb Date: Thu, 24 Nov 2011 17:05:18 +0000 Subject: [PATCH 16/23] virtfs: allow a device id to be specified in the -virtfs option When using a virtfs root filesystem, the mount_tag needs to be set to /dev/root. This can be done long-hand as -fsdev local,id=root,path=/path/to/rootfs,... -device virtio-9p-pci,fsdev=root,mount_tag=/dev/root but the -virtfs shortcut cannot be used as it hard-codes the device identifier to match the mount_tag, and device identifiers may not contain '/': $ qemu-system-x86_64 -virtfs local,path=/foo,mount_tag=/dev/root,security_model=passthrough qemu-system-x86_64: -virtfs local,path=/foo,mount_tag=/dev/root,security_model=passthrough: duplicate fsdev id: /dev/root To support this case using -virtfs, we allow the device identifier to be specified explicitly when the mount_tag is not suitable: -virtfs local,id=root,path=/path/to/rootfs,mount_tag=/dev/root,... Signed-off-by: Chris Webb Signed-off-by: Michael Tokarev --- qemu-options.hx | 2 +- vl.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index a24fef2107..a5b0589cb7 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -876,7 +876,7 @@ ETEXI DEF("virtfs", HAS_ARG, QEMU_OPTION_virtfs, "-virtfs local,path=path,mount_tag=tag,security_model=[mapped-xattr|mapped-file|passthrough|none]\n" - " [,writeout=immediate][,readonly][,socket=socket|sock_fd=sock_fd]\n", + " [,id=id][,writeout=immediate][,readonly][,socket=socket|sock_fd=sock_fd]\n", QEMU_ARCH_ALL) STEXI diff --git a/vl.c b/vl.c index 42d4bce439..10f3afd860 100644 --- a/vl.c +++ b/vl.c @@ -3524,10 +3524,11 @@ int main(int argc, char **argv, char **envp) exit(1); } fsdev = qemu_opts_create(qemu_find_opts("fsdev"), + qemu_opts_id(opts) ?: qemu_opt_get(opts, "mount_tag"), 1, NULL); if (!fsdev) { - error_report("duplicate fsdev id: %s", + error_report("duplicate or invalid fsdev id: %s", qemu_opt_get(opts, "mount_tag")); exit(1); } @@ -3565,7 +3566,7 @@ int main(int argc, char **argv, char **envp) &error_abort); qemu_opt_set(device, "driver", "virtio-9p-pci", &error_abort); qemu_opt_set(device, "fsdev", - qemu_opt_get(opts, "mount_tag"), &error_abort); + qemu_opts_id(fsdev), &error_abort); qemu_opt_set(device, "mount_tag", qemu_opt_get(opts, "mount_tag"), &error_abort); break; From 6f75023ab89708101dabc8f710bd0ed501311c8a Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Tue, 25 Apr 2017 15:18:28 +0200 Subject: [PATCH 17/23] scripts/qemu-binfmt-conf.sh: Fix shell portability issue Appease pkgsrc and use portable shell variable comparison. This switches "==" to "=". It should not be a functional change. Signed-off-by: Kamil Rytarowski Reviewed-by: Peter Maydell Reviewed-by: Laurent Vivier Signed-off-by: Michael Tokarev --- scripts/qemu-binfmt-conf.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 0f1aa63872..8afc3eb5bb 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -284,12 +284,12 @@ while true ; do shift # check given cpu is in the supported CPU list for cpu in ${qemu_target_list} ; do - if [ "$cpu" == "$1" ] ; then + if [ "$cpu" = "$1" ] ; then break fi done - if [ "$cpu" == "$1" ] ; then + if [ "$cpu" = "$1" ] ; then qemu_target_list="$1" else echo "ERROR: unknown CPU \"$1\"" 1>&2 From b7d5a9c2c672f6088bfa209c1338badbc51de3f3 Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Wed, 26 Apr 2017 15:16:04 +0200 Subject: [PATCH 18/23] scripts: Switch to more portable Perl shebang MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default NetBSD package manager is pkgsrc and it installs Perl along other third party programs under custom and configurable prefix. The default prefix for binary prebuilt packages is /usr/pkg, and the Perl executable lands in /usr/pkg/bin/perl. This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's the most portable solution that should work for almost everybody. Perl's executable is detected automatically. This change switches -w option passed to the executable with more modern "use warnings;" approach. There is no functional change to the default behavior. Signed-off-by: Kamil Rytarowski Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Michael Tokarev --- scripts/checkpatch.pl | 3 ++- scripts/clean-header-guards.pl | 3 ++- scripts/cleanup-trace-events.pl | 2 +- scripts/disas-objdump.pl | 4 +++- scripts/get_maintainer.pl | 3 ++- scripts/shaderinclude.pl | 2 +- scripts/switch-timer-api | 2 +- scripts/texi2pod.pl | 4 +++- 8 files changed, 15 insertions(+), 8 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index f084542934..3bb6fc95bd 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # (c) 2001, Dave Jones. (the file handling bit) # (c) 2005, Joel Schopp (the ugly bit) # (c) 2007,2008, Andy Whitcroft (new conditions, test suite) @@ -6,6 +6,7 @@ # Licensed under the terms of the GNU GPL License version 2 use strict; +use warnings; my $P = $0; $P =~ s@.*/@@g; diff --git a/scripts/clean-header-guards.pl b/scripts/clean-header-guards.pl index 54ab99ae29..5e67f1998c 100755 --- a/scripts/clean-header-guards.pl +++ b/scripts/clean-header-guards.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # # Clean up include guards in headers # @@ -28,6 +28,7 @@ # "cc -E -DGUARD_H -c -P -", and fed the test program on stdin. use strict; +use warnings; use Getopt::Std; # Stuff we don't want to clean because we import it into our tree: diff --git a/scripts/cleanup-trace-events.pl b/scripts/cleanup-trace-events.pl index 7e808efb6a..e93abc00da 100755 --- a/scripts/cleanup-trace-events.pl +++ b/scripts/cleanup-trace-events.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Copyright (C) 2013 Red Hat, Inc. # # Authors: diff --git a/scripts/disas-objdump.pl b/scripts/disas-objdump.pl index 8f7e8182a1..bec905f04b 100755 --- a/scripts/disas-objdump.pl +++ b/scripts/disas-objdump.pl @@ -1,4 +1,6 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl + +use warnings; use File::Temp qw/ tempfile /; use Getopt::Long; diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 8261bcb1ad..d7c2311123 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # (c) 2007, Joe Perches # created from checkpatch.pl # @@ -11,6 +11,7 @@ # Licensed under the terms of the GNU GPL License version 2 use strict; +use warnings; my $P = $0; my $V = '0.26'; diff --git a/scripts/shaderinclude.pl b/scripts/shaderinclude.pl index 81b5146332..cd3bb40b12 100644 --- a/scripts/shaderinclude.pl +++ b/scripts/shaderinclude.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; diff --git a/scripts/switch-timer-api b/scripts/switch-timer-api index b0e230b9f1..41736d11dd 100755 --- a/scripts/switch-timer-api +++ b/scripts/switch-timer-api @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; diff --git a/scripts/texi2pod.pl b/scripts/texi2pod.pl index 6e8fec41a1..39ce584a32 100755 --- a/scripts/texi2pod.pl +++ b/scripts/texi2pod.pl @@ -1,4 +1,4 @@ -#! /usr/bin/perl -w +#! /usr/bin/env perl # Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. @@ -22,6 +22,8 @@ # markup to Perl POD format. It's intended to be used to extract # something suitable for a manpage from a Texinfo document. +use warnings; + $output = 0; $skipping = 0; %sects = (); From fafa2e6702a1ae4f094f8d5b79afef1e641ea3bb Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 27 Apr 2017 21:23:29 -0500 Subject: [PATCH 19/23] tests: Ignore another built executable (test-hmp) Commit 78f86a2b7 added a new test, but forgot to exclude the built binary from version control. Signed-off-by: Eric Blake Reviewed-by: Thomas Huth Signed-off-by: Michael Tokarev --- tests/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/.gitignore b/tests/.gitignore index 5ab00a9c95..40c2e3e757 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -40,6 +40,7 @@ test-crypto-tlssession-server/ test-crypto-xts test-cutils test-hbitmap +test-hmp test-int128 test-iov test-io-channel-buffer From e9c6ab62c760e333a6cf0f3f9ab021633723434c Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 3 May 2017 12:44:41 +0200 Subject: [PATCH 20/23] jazz_led: fix bad snprintf Detected by GCC 7's -Wformat-truncation. snprintf writes at most 2 bytes here including the terminating NUL, so the result is truncated. In addition, the newline at the end is pointless. Fix the buffer size and the format string. Signed-off-by: Paolo Bonzini Reviewed-by: Markus Armbruster Reviewed-by: Laurent Vivier Signed-off-by: Michael Tokarev --- hw/display/jazz_led.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/display/jazz_led.c b/hw/display/jazz_led.c index b72fdb1717..3c97d56434 100644 --- a/hw/display/jazz_led.c +++ b/hw/display/jazz_led.c @@ -227,13 +227,13 @@ static void jazz_led_invalidate_display(void *opaque) static void jazz_led_text_update(void *opaque, console_ch_t *chardata) { LedState *s = opaque; - char buf[2]; + char buf[3]; dpy_text_cursor(s->con, -1, -1); qemu_console_resize(s->con, 2, 1); /* TODO: draw the segments */ - snprintf(buf, 2, "%02hhx\n", s->segments); + snprintf(buf, 3, "%02hhx", s->segments); console_write_ch(chardata++, ATTR2CHTYPE(buf[0], QEMU_COLOR_BLUE, QEMU_COLOR_BLACK, 1)); console_write_ch(chardata++, ATTR2CHTYPE(buf[1], QEMU_COLOR_BLUE, From 3ecb29a3280b706aebfbc353718c8272eb3ea9db Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 3 May 2017 13:59:09 +0200 Subject: [PATCH 21/23] MAINTAINERS: Update paths for main loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moved by c2b38b2 ("block: move AioContext, QEMUTimer, main-loop to libqemuutil"), let's update MAINTAINERS too. Reported-by: Laurent Vivier Signed-off-by: Paolo Bonzini Reviewed-by: Alex Bennée Signed-off-by: Michael Tokarev --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index a1d2b3a4d3..e6822b23bf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1305,8 +1305,8 @@ Main loop M: Paolo Bonzini S: Maintained F: cpus.c -F: main-loop.c -F: qemu-timer.c +F: util/main-loop.c +F: util/qemu-timer.c F: vl.c Human Monitor (HMP) From 36c697bda59acf1f8d67a437403f857ec905f2ba Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 3 May 2017 12:30:23 +0200 Subject: [PATCH 22/23] MAINTAINERS: Update paths for AioContext implementation Moved by c2b38b2 ("block: move AioContext, QEMUTimer, main-loop to libqemuutil") Signed-off-by: Paolo Bonzini Reviewed-by: Laurent Vivier Signed-off-by: Michael Tokarev --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index e6822b23bf..e79ffb3f8a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1175,8 +1175,8 @@ M: Stefan Hajnoczi M: Fam Zheng L: qemu-block@nongnu.org S: Supported -F: async.c -F: aio-*.c +F: util/async.c +F: util/aio-*.c F: block/io.c F: migration/block* F: include/block/aio.h From e1ae9fb6c2a35015ed4881def4a4a7b6be2d15f0 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Fri, 5 May 2017 10:04:30 +0800 Subject: [PATCH 23/23] tests: Remove redundant assignment Signed-off-by: Fam Zheng Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- tests/postcopy-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/postcopy-test.c b/tests/postcopy-test.c index de35a18903..e86f87656a 100644 --- a/tests/postcopy-test.c +++ b/tests/postcopy-test.c @@ -41,7 +41,7 @@ static bool ufd_version_check(void) struct uffdio_api api_struct; uint64_t ioctl_mask; - int ufd = ufd = syscall(__NR_userfaultfd, O_CLOEXEC); + int ufd = syscall(__NR_userfaultfd, O_CLOEXEC); if (ufd == -1) { g_test_message("Skipping test: userfaultfd not available");