From bd947d30b6757067fa8f8407ef248fd8645383ee Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 4 Jan 2012 22:47:16 +0100 Subject: [PATCH 01/12] configure: Modify detection of supported warning options Reversing the order of the warning options and -Werror is important when clang is used instead of gcc. It changes nothing for gcc. Signed-off-by: Stefan Weil Signed-off-by: Stefan Hajnoczi --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index eb9a01d657..467e87bf09 100755 --- a/configure +++ b/configure @@ -1105,7 +1105,7 @@ cat > $TMPC << EOF int main(void) { return 0; } EOF for flag in $gcc_flags; do - if compile_prog "$flag -Werror" "" ; then + if compile_prog "-Werror $flag" "" ; then QEMU_CFLAGS="$QEMU_CFLAGS $flag" fi done From 5c84bd904ba0aacdb295df5ff7c90ef941f469bb Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Sat, 7 Jan 2012 21:00:25 +0100 Subject: [PATCH 02/12] tcg-arm: fix a typo in comments ARM still doesn't support 16GB buffers in 32-bit modes, replace the 16GB by 16MB in the comment. Reviewed-by: Peter Maydell Signed-off-by: Aurelien Jarno Signed-off-by: Stefan Hajnoczi --- exec.c | 2 +- tcg/arm/tcg-target.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index b1d6602911..7f9f730250 100644 --- a/exec.c +++ b/exec.c @@ -511,7 +511,7 @@ static void code_gen_alloc(unsigned long tb_size) if (code_gen_buffer_size > (512 * 1024 * 1024)) code_gen_buffer_size = (512 * 1024 * 1024); #elif defined(__arm__) - /* Keep the buffer no bigger than 16GB to branch between blocks */ + /* Keep the buffer no bigger than 16MB to branch between blocks */ if (code_gen_buffer_size > 16 * 1024 * 1024) code_gen_buffer_size = 16 * 1024 * 1024; #elif defined(__s390x__) diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c index 1d327984e0..5b233f564c 100644 --- a/tcg/arm/tcg-target.c +++ b/tcg/arm/tcg-target.c @@ -843,7 +843,7 @@ static inline void tcg_out_st8(TCGContext *s, int cond, } /* The _goto case is normally between TBs within the same code buffer, - * and with the code buffer limited to 16GB we shouldn't need the long + * and with the code buffer limited to 16MB we shouldn't need the long * case. * * .... except to the prologue that is in its own buffer. From dabdf394258aaa040fa0e754d6d05d7833542033 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 8 Jan 2012 19:35:09 +0100 Subject: [PATCH 03/12] Spelling fixes in comments and documentation Codespell detected these new spelling issues. Signed-off-by: Stefan Weil Signed-off-by: Stefan Hajnoczi --- docs/writing-qmp-commands.txt | 2 +- memory.h | 4 ++-- qemu-ga.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/writing-qmp-commands.txt b/docs/writing-qmp-commands.txt index 0472fc3914..0ad51aa22a 100644 --- a/docs/writing-qmp-commands.txt +++ b/docs/writing-qmp-commands.txt @@ -435,7 +435,7 @@ There are a number of things to be noticed: for all QMP functions) 3. The "clock" variable (which will point to our QAPI type instance) is allocated by the regular g_malloc0() function. Note that we chose to - initialize the memory to zero. This is recomended for all QAPI types, as + initialize the memory to zero. This is recommended for all QAPI types, as it helps avoiding bad surprises (specially with booleans) 4. Remember that "next_deadline" is optional? All optional members have a 'has_TYPE_NAME' member that should be properly set by the implementation, diff --git a/memory.h b/memory.h index 70f57fbc12..d48b08bf94 100644 --- a/memory.h +++ b/memory.h @@ -561,7 +561,7 @@ void memory_region_add_subregion_overlap(MemoryRegion *mr, * memory_region_get_ram_addr: Get the ram address associated with a memory * region * - * DO NOT USE THIS FUCNTION. This is a temporary workaround while the Xen + * DO NOT USE THIS FUNCTION. This is a temporary workaround while the Xen * code is being reworked. */ ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr); @@ -650,7 +650,7 @@ void memory_global_sync_dirty_bitmap(MemoryRegion *address_space); * memory_region_transaction_begin: Start a transaction. * * During a transaction, changes will be accumulated and made visible - * only when the transaction ends (is commited). + * only when the transaction ends (is committed). */ void memory_region_transaction_begin(void); diff --git a/qemu-ga.c b/qemu-ga.c index 200bb1585f..29e4f642b7 100644 --- a/qemu-ga.c +++ b/qemu-ga.c @@ -92,7 +92,7 @@ static void usage(const char *cmd) " -v, --verbose log extra debugging information\n" " -V, --version print version information and exit\n" " -d, --daemonize become a daemon\n" -" -b, --blacklist comma-seperated list of RPCs to disable (no spaces, \"?\"" +" -b, --blacklist comma-separated list of RPCs to disable (no spaces, \"?\"" " to list available RPCs)\n" " -h, --help display this help and exit\n" "\n" From 8d98734651a8a601980b6e57788f2ed6a4ea620a Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Fri, 6 Jan 2012 16:57:44 +0000 Subject: [PATCH 04/12] vvfat: avoid leaking file descriptor in commit_one_file() Reported-by: Dr David Alan Gilbert Signed-off-by: Stefan Hajnoczi --- block/vvfat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/vvfat.c b/block/vvfat.c index eeffc4a4a8..9ef21ddfc5 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -2218,6 +2218,7 @@ static int commit_one_file(BDRVVVFATState* s, } if (offset > 0) { if (lseek(fd, offset, SEEK_SET) != offset) { + close(fd); g_free(cluster); return -3; } @@ -2238,11 +2239,13 @@ static int commit_one_file(BDRVVVFATState* s, (uint8_t*)cluster, (rest_size + 0x1ff) / 0x200); if (ret < 0) { + close(fd); g_free(cluster); return ret; } if (write(fd, cluster, rest_size) < 0) { + close(fd); g_free(cluster); return -2; } From cee8e6add587e20ed1f4c5a95031a1697d7375b1 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Fri, 6 Jan 2012 16:57:45 +0000 Subject: [PATCH 05/12] vnc: fix no-lock-key-sync strncmp() length The no-lock-key-sync option is being parsed incorrectly because of an outdated strcmp() length value. Use the correct length so that invalid option names do not match. Reported-by: Dr David Alan Gilbert Signed-off-by: Stefan Hajnoczi --- ui/vnc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/vnc.c b/ui/vnc.c index 6767ada7d2..1869a7adea 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2763,7 +2763,7 @@ int vnc_display_open(DisplayState *ds, const char *display) password = 1; /* Require password auth */ } else if (strncmp(options, "reverse", 7) == 0) { reverse = 1; - } else if (strncmp(options, "no-lock-key-sync", 9) == 0) { + } else if (strncmp(options, "no-lock-key-sync", 16) == 0) { lock_key_sync = 0; #ifdef CONFIG_VNC_SASL } else if (strncmp(options, "sasl", 4) == 0) { From 3c8359d11aee9d3fdcab0f184605f603f91f34f7 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Sat, 7 Jan 2012 11:59:59 +0000 Subject: [PATCH 06/12] omap_dss: correct chip[1] index in RFBI_READ/RFBI_STATUS The RFBI_READ/RFBI_STATUS code incorrectly uses chip[0] when it should be using chip[1]. Andrzej Zaborowski confirmed this bug since I don't know this code well. Reported-by: Dr David Alan Gilbert Reviewed-by: Andrzej Zaborowski Signed-off-by: Stefan Hajnoczi --- hw/omap_dss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/omap_dss.c b/hw/omap_dss.c index ede640b92e..86ed6ea5d9 100644 --- a/hw/omap_dss.c +++ b/hw/omap_dss.c @@ -793,7 +793,7 @@ static void omap_rfbi_write(void *opaque, target_phys_addr_t addr, if ((s->rfbi.control & (1 << 2)) && s->rfbi.chip[0]) s->rfbi.rxbuf = s->rfbi.chip[0]->read(s->rfbi.chip[0]->opaque, 1); else if ((s->rfbi.control & (1 << 3)) && s->rfbi.chip[1]) - s->rfbi.rxbuf = s->rfbi.chip[0]->read(s->rfbi.chip[0]->opaque, 1); + s->rfbi.rxbuf = s->rfbi.chip[1]->read(s->rfbi.chip[1]->opaque, 1); if (!-- s->rfbi.pixels) omap_rfbi_transfer_stop(s); break; @@ -802,7 +802,7 @@ static void omap_rfbi_write(void *opaque, target_phys_addr_t addr, if ((s->rfbi.control & (1 << 2)) && s->rfbi.chip[0]) s->rfbi.rxbuf = s->rfbi.chip[0]->read(s->rfbi.chip[0]->opaque, 0); else if ((s->rfbi.control & (1 << 3)) && s->rfbi.chip[1]) - s->rfbi.rxbuf = s->rfbi.chip[0]->read(s->rfbi.chip[0]->opaque, 0); + s->rfbi.rxbuf = s->rfbi.chip[1]->read(s->rfbi.chip[1]->opaque, 0); if (!-- s->rfbi.pixels) omap_rfbi_transfer_stop(s); break; From 0b0404bf84432f0ee74840d674b93bacee7eee68 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 9 Jan 2012 18:29:51 +0100 Subject: [PATCH 07/12] Add 'fall through' comments to case statements without break These comments are used by static code analysis tools and in code reviews to avoid false warnings because of missing break statements. The case statements handled here were reported by coverity. Reviewed-by: Peter Maydell Signed-off-by: Stefan Weil Signed-off-by: Stefan Hajnoczi --- hw/pcnet.c | 1 + json-lexer.c | 1 + qemu-option.c | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/hw/pcnet.c b/hw/pcnet.c index cba253ba7b..306dc6ed7e 100644 --- a/hw/pcnet.c +++ b/hw/pcnet.c @@ -1505,6 +1505,7 @@ static void pcnet_bcr_writew(PCNetState *s, uint32_t rap, uint32_t val) #ifdef PCNET_DEBUG printf("BCR_SWS=0x%04x\n", val); #endif + /* fall through */ case BCR_LNKST: case BCR_LED1: case BCR_LED2: diff --git a/json-lexer.c b/json-lexer.c index c21338f66d..3cd3285825 100644 --- a/json-lexer.c +++ b/json-lexer.c @@ -301,6 +301,7 @@ static int json_lexer_feed_char(JSONLexer *lexer, char ch, bool flush) case JSON_KEYWORD: case JSON_STRING: lexer->emit(lexer, lexer->token, new_state, lexer->x, lexer->y); + /* fall through */ case JSON_SKIP: QDECREF(lexer->token); lexer->token = qstring_new(); diff --git a/qemu-option.c b/qemu-option.c index 6b23c31235..a303f87e1c 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -214,13 +214,17 @@ static int parse_option_size(const char *name, const char *value, uint64_t *ret) switch (*postfix) { case 'T': sizef *= 1024; + /* fall through */ case 'G': sizef *= 1024; + /* fall through */ case 'M': sizef *= 1024; + /* fall through */ case 'K': case 'k': sizef *= 1024; + /* fall through */ case 'b': case '\0': *ret = (uint64_t) sizef; From f46cee374218dc5ebda3e7aa6996ef7f1b90eb7c Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Wed, 11 Jan 2012 10:51:52 -0500 Subject: [PATCH 08/12] hmp: Fix freeing of PciInfoList Remember the original PciInfoList in info_list and use the info variable to traverse the list. Signed-off-by: Stefan Berger Signed-off-by: Stefan Hajnoczi --- hmp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hmp.c b/hmp.c index e7659d5ffc..fd4f755232 100644 --- a/hmp.c +++ b/hmp.c @@ -486,17 +486,17 @@ static void hmp_info_pci_device(Monitor *mon, const PciDeviceInfo *dev) void hmp_info_pci(Monitor *mon) { - PciInfoList *info; + PciInfoList *info_list, *info; Error *err = NULL; - info = qmp_query_pci(&err); + info_list = qmp_query_pci(&err); if (err) { monitor_printf(mon, "PCI devices not supported\n"); error_free(err); return; } - for (; info; info = info->next) { + for (info = info_list; info; info = info->next) { PciDeviceInfoList *dev; for (dev = info->value->devices; dev; dev = dev->next) { @@ -504,7 +504,7 @@ void hmp_info_pci(Monitor *mon) } } - qapi_free_PciInfoList(info); + qapi_free_PciInfoList(info_list); } void hmp_quit(Monitor *mon, const QDict *qdict) From 822b635d903306e2ea0b7f835d4a5afc3a66e996 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 11 Jan 2012 19:34:29 +0100 Subject: [PATCH 09/12] virtfs-proxy-helper: Fix compilation on newer systems Include file attr/xattr.h is not available on "newer" systems (for example Fedora 12 or Debian Squeeze). See comments in qemu-xattr.h for more information. This file handles the system dependencies automatically. Signed-off-by: Stefan Weil Signed-off-by: Stefan Hajnoczi --- fsdev/virtfs-proxy-helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c index 7f8def5b5d..ce7eb79d75 100644 --- a/fsdev/virtfs-proxy-helper.c +++ b/fsdev/virtfs-proxy-helper.c @@ -27,13 +27,13 @@ #include #include #include -#include #include #include #ifdef CONFIG_LINUX_MAGIC_H #include #endif #include "qemu-common.h" +#include "qemu-xattr.h" #include "virtio-9p-marshal.h" #include "hw/9pfs/virtio-9p-proxy.h" #include "fsdev/virtio-9p-marshal.h" From e7e4a6ccae023ab4b9650aed6af369088ef08e3b Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 11 Jan 2012 19:34:30 +0100 Subject: [PATCH 10/12] virtfs-proxy-helper: Clean include files The common standard include files are already included via qemu-common.h, and for the socket related include files there is qemu_socket.h, so the code can be reduced by some lines. Signed-off-by: Stefan Weil Signed-off-by: Stefan Hajnoczi --- fsdev/virtfs-proxy-helper.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c index ce7eb79d75..21e9b160c2 100644 --- a/fsdev/virtfs-proxy-helper.c +++ b/fsdev/virtfs-proxy-helper.c @@ -8,31 +8,20 @@ * This work is licensed under the terms of the GNU GPL, version 2. See * the COPYING file in the top-level directory. */ -#include -#include -#include -#include -#include -#include -#include -#include + #include -#include #include -#include #include #include #include -#include -#include #include -#include #include #include #ifdef CONFIG_LINUX_MAGIC_H #include #endif #include "qemu-common.h" +#include "qemu_socket.h" #include "qemu-xattr.h" #include "virtio-9p-marshal.h" #include "hw/9pfs/virtio-9p-proxy.h" From c5c7d3f0a79a977955e9df436cf9ca17269b8783 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 11 Jan 2012 19:47:37 +0100 Subject: [PATCH 11/12] virtfs-proxy-helper: Add missing printf format attribute Every function with printf like arguments must have it (see file HACKING), so add it. Signed-off-by: Stefan Weil Signed-off-by: Stefan Hajnoczi --- fsdev/virtfs-proxy-helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c index 21e9b160c2..4a507d860e 100644 --- a/fsdev/virtfs-proxy-helper.c +++ b/fsdev/virtfs-proxy-helper.c @@ -54,7 +54,7 @@ static struct option helper_opts[] = { static bool is_daemon; static bool get_version; /* IOC getversion IOCTL supported */ -static void do_log(int loglevel, const char *format, ...) +static void GCC_FMT_ATTR(2, 3) do_log(int loglevel, const char *format, ...) { va_list ap; From f7253270fc66a60e4faf639a3c4ce0b352553b24 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Thu, 12 Jan 2012 14:17:04 +0000 Subject: [PATCH 12/12] bt-host: add missing break statement The switch statement in bt_host_read() is missing a break in one case. Andrzej Zaborowski confirmed that this is not an intentional fall-through. Reviewed-by: Stefan Weil Signed-off-by: Stefan Hajnoczi --- bt-host.c | 1 + 1 file changed, 1 insertion(+) diff --git a/bt-host.c b/bt-host.c index df5b7cdace..0d3ad28e8c 100644 --- a/bt-host.c +++ b/bt-host.c @@ -130,6 +130,7 @@ static void bt_host_read(void *opaque) pktlen = MIN(pkt[2] + 3, s->len); s->len -= pktlen; pkt += pktlen; + break; default: bad_pkt: