diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2015-02-10 09:51:46 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2015-02-10 09:51:46 +0000 |
commit | 5c697ae74170d43928cb185f5ac1a9058adcae0b (patch) | |
tree | 1bc668205decf1076e578ba777dc7bcaca9d3845 | |
parent | 89db21771782fd6050335e73542064f1187c9ced (diff) | |
parent | 43d735547b2a29cafd7d9529ac38734950b235f7 (diff) | |
download | qemu-5c697ae74170d43928cb185f5ac1a9058adcae0b.zip |
Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2015-02-10' into staging
trivial patches for 2015-02-10
# gpg: Signature made Tue 10 Feb 2015 07:27:11 GMT using RSA key ID A4C3D7DB
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg: aka "Michael Tokarev <mjt@corpit.ru>"
# gpg: aka "Michael Tokarev <mjt@debian.org>"
* remotes/mjt/tags/pull-trivial-patches-2015-02-10: (45 commits)
virtio: Fix warning caused by missing 'static' attribute
vga: Fix warning caused by missing 'static' attribute
stubs: Fix warning caused by missing include statement
spice: Add missing 'static' attribute
serial: Fix warnings caused by missing 'static' attribute
moxie: Fix warning caused by missing include statement
migration: Fix warnings caused by missing 'static' attribute
migration: Fix warning caused by missing declaration of vmstate_dummy
disas/sh4: Fix warning caused by missing 'static' attribute
translate-all: Use g_try_malloc() for dynamic translator buffer
vnc: g_realloc() can't fail, bury dead error handling
rdma: g_malloc0() can't fail, bury dead error handling
kvm: g_malloc() can't fail, bury dead error handling
rtl8139: g_malloc() can't fail, bury dead error handling
onenand: g_malloc() can't fail, bury dead error handling
Fix name error in migration stream analyzation script
QJSON: fix typo in author's email address
util/uri: URI member path can be null, compare more carfully
util/uri: realloc2n() can't fail, drop dead error handling
util/uri: uri_new() can't fail, drop dead error handling
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
38 files changed, 223 insertions, 217 deletions
diff --git a/cpu-exec.c b/cpu-exec.c index fa506e628a..67381176da 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -494,28 +494,22 @@ int cpu_exec(CPUArchState *env) * interrupt_request) which we will handle * next time around the loop. */ - tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK); next_tb = 0; break; case TB_EXIT_ICOUNT_EXPIRED: { /* Instruction counter expired. */ - int insns_left; - tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK); - insns_left = cpu->icount_decr.u32; + int insns_left = cpu->icount_decr.u32; if (cpu->icount_extra && insns_left >= 0) { /* Refill decrementer and continue execution. */ cpu->icount_extra += insns_left; - if (cpu->icount_extra > 0xffff) { - insns_left = 0xffff; - } else { - insns_left = cpu->icount_extra; - } + insns_left = MIN(0xffff, cpu->icount_extra); cpu->icount_extra -= insns_left; cpu->icount_decr.u16.low = insns_left; } else { if (insns_left > 0) { /* Execute remaining instructions. */ + tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK); cpu_exec_nocache(env, insns_left, tb); align_clocks(&sc, cpu); } diff --git a/disas/sh4.c b/disas/sh4.c index f6cadd55c0..020f5ebb7b 100644 --- a/disas/sh4.c +++ b/disas/sh4.c @@ -332,7 +332,7 @@ typedef struct #ifdef DEFINE_TABLE -const sh_opcode_info sh_table[] = +static const sh_opcode_info sh_table[] = { /* 0111nnnni8*1.... add #<imm>,<REG_N> */{"add",{A_IMM,A_REG_N},{HEX_7,REG_N,IMM0_8}, arch_sh1_up}, diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c index cd291d32f2..c1da2d78e7 100644 --- a/fsdev/virtfs-proxy-helper.c +++ b/fsdev/virtfs-proxy-helper.c @@ -749,24 +749,29 @@ static int proxy_socket(const char *path, uid_t uid, gid_t gid) if (bind(sock, (struct sockaddr *)&proxy, sizeof(struct sockaddr_un)) < 0) { do_perror("bind"); - return -1; + goto error; } if (chown(proxy.sun_path, uid, gid) < 0) { do_perror("chown"); - return -1; + goto error; } if (listen(sock, 1) < 0) { do_perror("listen"); - return -1; + goto error; } size = sizeof(qemu); client = accept(sock, (struct sockaddr *)&qemu, &size); if (client < 0) { do_perror("accept"); - return -1; + goto error; } + close(sock); return client; + +error: + close(sock); + return -1; } static void usage(char *prog) diff --git a/hw/block/onenand.c b/hw/block/onenand.c index 348630d905..1b2c893756 100644 --- a/hw/block/onenand.c +++ b/hw/block/onenand.c @@ -346,15 +346,9 @@ static inline int onenand_prog_spare(OneNANDState *s, int sec, int secn, static inline int onenand_erase(OneNANDState *s, int sec, int num) { uint8_t *blankbuf, *tmpbuf; + blankbuf = g_malloc(512); - if (!blankbuf) { - return 1; - } tmpbuf = g_malloc(512); - if (!tmpbuf) { - g_free(blankbuf); - return 1; - } memset(blankbuf, 0xff, 512); for (; num > 0; num--, sec++) { if (s->blk_cur) { diff --git a/hw/char/serial.c b/hw/char/serial.c index bd25c03bea..04918979d8 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -658,7 +658,7 @@ static bool serial_thr_ipending_needed(void *opaque) } } -const VMStateDescription vmstate_serial_thr_ipending = { +static const VMStateDescription vmstate_serial_thr_ipending = { .name = "serial/thr_ipending", .version_id = 1, .minimum_version_id = 1, @@ -674,7 +674,7 @@ static bool serial_tsr_needed(void *opaque) return s->tsr_retry != 0; } -const VMStateDescription vmstate_serial_tsr = { +static const VMStateDescription vmstate_serial_tsr = { .name = "serial/tsr", .version_id = 1, .minimum_version_id = 1, @@ -693,7 +693,7 @@ static bool serial_recv_fifo_needed(void *opaque) } -const VMStateDescription vmstate_serial_recv_fifo = { +static const VMStateDescription vmstate_serial_recv_fifo = { .name = "serial/recv_fifo", .version_id = 1, .minimum_version_id = 1, @@ -709,7 +709,7 @@ static bool serial_xmit_fifo_needed(void *opaque) return !fifo8_is_empty(&s->xmit_fifo); } -const VMStateDescription vmstate_serial_xmit_fifo = { +static const VMStateDescription vmstate_serial_xmit_fifo = { .name = "serial/xmit_fifo", .version_id = 1, .minimum_version_id = 1, @@ -725,7 +725,7 @@ static bool serial_fifo_timeout_timer_needed(void *opaque) return timer_pending(s->fifo_timeout_timer); } -const VMStateDescription vmstate_serial_fifo_timeout_timer = { +static const VMStateDescription vmstate_serial_fifo_timeout_timer = { .name = "serial/fifo_timeout_timer", .version_id = 1, .minimum_version_id = 1, @@ -741,7 +741,7 @@ static bool serial_timeout_ipending_needed(void *opaque) return s->timeout_ipending != 0; } -const VMStateDescription vmstate_serial_timeout_ipending = { +static const VMStateDescription vmstate_serial_timeout_ipending = { .name = "serial/timeout_ipending", .version_id = 1, .minimum_version_id = 1, @@ -757,7 +757,7 @@ static bool serial_poll_needed(void *opaque) return s->poll_msl >= 0; } -const VMStateDescription vmstate_serial_poll = { +static const VMStateDescription vmstate_serial_poll = { .name = "serial/poll", .version_id = 1, .minimum_version_id = 1, diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 37a6f442fa..47fbb34bdd 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -26,7 +26,7 @@ #include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-access.h" -struct VirtIOSerialDevices { +static struct VirtIOSerialDevices { QLIST_HEAD(, VirtIOSerial) devices; } vserdevices; diff --git a/hw/core/fw-path-provider.c b/hw/core/fw-path-provider.c index 1290c3e600..7442d322d5 100644 --- a/hw/core/fw-path-provider.c +++ b/hw/core/fw-path-provider.c @@ -1,5 +1,5 @@ /* - * Firmware patch provider class and helpers. + * Firmware path provider class and helpers. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/hw/display/vga.c b/hw/display/vga.c index ffcfce38a4..9c62fbf488 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -2032,7 +2032,7 @@ static bool vga_endian_state_needed(void *opaque) return s->default_endian_fb != s->big_endian_fb; } -const VMStateDescription vmstate_vga_endian = { +static const VMStateDescription vmstate_vga_endian = { .name = "vga.endian", .version_id = 1, .minimum_version_id = 1, diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index 8a61e959a6..5e324ef62d 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -45,6 +45,8 @@ #include <xen/io/kbdif.h> #include <xen/io/protocols.h> +#include "trace.h" + #ifndef BTN_LEFT #define BTN_LEFT 0x110 /* from <linux/input.h> */ #endif @@ -324,6 +326,8 @@ static void xenfb_mouse_event(void *opaque, int dh = surface_height(surface); int i; + trace_xenfb_mouse_event(opaque, dx, dy, dz, button_state, + xenfb->abs_pointer_wanted); if (xenfb->abs_pointer_wanted) xenfb_send_position(xenfb, dx * (dw - 1) / 0x7fff, @@ -380,6 +384,7 @@ static void input_connected(struct XenDevice *xendev) if (in->qmouse) { qemu_remove_mouse_event_handler(in->qmouse); } + trace_xenfb_input_connected(xendev, in->abs_pointer_wanted); in->qmouse = qemu_add_mouse_event_handler(xenfb_mouse_event, in, in->abs_pointer_wanted, "Xen PVFB Mouse"); diff --git a/hw/input/ps2.c b/hw/input/ps2.c index a466e250a4..4baeea2b56 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -27,6 +27,8 @@ #include "ui/input.h" #include "sysemu/sysemu.h" +#include "trace.h" + /* debug PC keyboard */ //#define DEBUG_KBD @@ -158,6 +160,7 @@ static void ps2_put_keycode(void *opaque, int keycode) { PS2KbdState *s = opaque; + trace_ps2_put_keycode(opaque, keycode); qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER); /* XXX: add support for scancode set 1 */ if (!s->translate && keycode < 0xe0 && s->scancode_set > 1) { @@ -194,6 +197,7 @@ uint32_t ps2_read_data(void *opaque) PS2Queue *q; int val, index; + trace_ps2_read_data(opaque); q = &s->queue; if (q->count == 0) { /* NOTE: if no data left, we return the last keyboard one @@ -218,12 +222,14 @@ uint32_t ps2_read_data(void *opaque) static void ps2_set_ledstate(PS2KbdState *s, int ledstate) { + trace_ps2_set_ledstate(s, ledstate); s->ledstate = ledstate; kbd_put_ledstate(ledstate); } static void ps2_reset_keyboard(PS2KbdState *s) { + trace_ps2_reset_keyboard(s); s->scan_enabled = 1; s->scancode_set = 2; ps2_set_ledstate(s, 0); @@ -233,6 +239,7 @@ void ps2_write_keyboard(void *opaque, int val) { PS2KbdState *s = (PS2KbdState *)opaque; + trace_ps2_write_keyboard(opaque, val); switch(s->common.write_cmd) { default: case -1: @@ -319,6 +326,7 @@ void ps2_write_keyboard(void *opaque, int val) void ps2_keyboard_set_translation(void *opaque, int mode) { PS2KbdState *s = (PS2KbdState *)opaque; + trace_ps2_keyboard_set_translation(opaque, mode); s->translate = mode; } @@ -364,6 +372,7 @@ static void ps2_mouse_send_packet(PS2MouseState *s) break; } + trace_ps2_mouse_send_packet(s, dx1, dy1, dz1, b); /* update deltas */ s->mouse_dx -= dx1; s->mouse_dy -= dy1; @@ -433,6 +442,7 @@ static void ps2_mouse_sync(DeviceState *dev) void ps2_mouse_fake_event(void *opaque) { PS2MouseState *s = opaque; + trace_ps2_mouse_fake_event(opaque); s->mouse_dx++; ps2_mouse_sync(opaque); } @@ -440,6 +450,8 @@ void ps2_mouse_fake_event(void *opaque) void ps2_write_mouse(void *opaque, int val) { PS2MouseState *s = (PS2MouseState *)opaque; + + trace_ps2_write_mouse(opaque, val); #ifdef DEBUG_MOUSE printf("kbd: write mouse 0x%02x\n", val); #endif @@ -606,6 +618,7 @@ static void ps2_kbd_reset(void *opaque) { PS2KbdState *s = (PS2KbdState *) opaque; + trace_ps2_kbd_reset(opaque); ps2_common_reset(&s->common); s->scan_enabled = 0; s->translate = 0; @@ -616,6 +629,7 @@ static void ps2_mouse_reset(void *opaque) { PS2MouseState *s = (PS2MouseState *) opaque; + trace_ps2_mouse_reset(opaque); ps2_common_reset(&s->common); s->mouse_status = 0; s->mouse_resolution = 0; @@ -763,6 +777,7 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg) { PS2KbdState *s = (PS2KbdState *)g_malloc0(sizeof(PS2KbdState)); + trace_ps2_kbd_init(s); s->common.update_irq = update_irq; s->common.update_arg = update_arg; s->scancode_set = 2; @@ -784,6 +799,7 @@ void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg) { PS2MouseState *s = (PS2MouseState *)g_malloc0(sizeof(PS2MouseState)); + trace_ps2_mouse_init(s); s->common.update_irq = update_irq; s->common.update_arg = update_arg; vmstate_register(NULL, 0, &vmstate_ps2_mouse, s); diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c index b86bc0d79b..5df79f0a1f 100644 --- a/hw/net/pcnet-pci.c +++ b/hw/net/pcnet-pci.c @@ -33,6 +33,7 @@ #include "qemu/timer.h" #include "sysemu/dma.h" #include "sysemu/sysemu.h" +#include "trace.h" #include "pcnet.h" @@ -61,9 +62,8 @@ typedef struct { static void pcnet_aprom_writeb(void *opaque, uint32_t addr, uint32_t val) { PCNetState *s = opaque; -#ifdef PCNET_DEBUG - printf("pcnet_aprom_writeb addr=0x%08x val=0x%02x\n", addr, val); -#endif + + trace_pcnet_aprom_writeb(opaque, addr, val); if (BCR_APROMWE(s)) { s->prom[addr & 15] = val; } @@ -73,9 +73,8 @@ static uint32_t pcnet_aprom_readb(void *opaque, uint32_t addr) { PCNetState *s = opaque; uint32_t val = s->prom[addr & 15]; -#ifdef PCNET_DEBUG - printf("pcnet_aprom_readb addr=0x%08x val=0x%02x\n", addr, val); -#endif + + trace_pcnet_aprom_readb(opaque, addr, val); return val; } @@ -84,6 +83,7 @@ static uint64_t pcnet_ioport_read(void *opaque, hwaddr addr, { PCNetState *d = opaque; + trace_pcnet_ioport_read(opaque, addr, size); if (addr < 0x10) { if (!BCR_DWIO(d) && size == 1) { return pcnet_aprom_readb(d, addr); @@ -111,6 +111,7 @@ static void pcnet_ioport_write(void *opaque, hwaddr addr, { PCNetState *d = opaque; + trace_pcnet_ioport_write(opaque, addr, data, size); if (addr < 0x10) { if (!BCR_DWIO(d) && size == 1) { pcnet_aprom_writeb(d, addr, data); @@ -141,10 +142,8 @@ static const MemoryRegionOps pcnet_io_ops = { static void pcnet_mmio_writeb(void *opaque, hwaddr addr, uint32_t val) { PCNetState *d = opaque; -#ifdef PCNET_DEBUG_IO - printf("pcnet_mmio_writeb addr=0x" TARGET_FMT_plx" val=0x%02x\n", addr, - val); -#endif + + trace_pcnet_mmio_writeb(opaque, addr, val); if (!(addr & 0x10)) pcnet_aprom_writeb(d, addr & 0x0f, val); } @@ -153,22 +152,18 @@ static uint32_t pcnet_mmio_readb(void *opaque, hwaddr addr) { PCNetState *d = opaque; uint32_t val = -1; + if (!(addr & 0x10)) val = pcnet_aprom_readb(d, addr & 0x0f); -#ifdef PCNET_DEBUG_IO - printf("pcnet_mmio_readb addr=0x" TARGET_FMT_plx " val=0x%02x\n", addr, - val & 0xff); -#endif + trace_pcnet_mmio_readb(opaque, addr, val); return val; } static void pcnet_mmio_writew(void *opaque, hwaddr addr, uint32_t val) { PCNetState *d = opaque; -#ifdef PCNET_DEBUG_IO - printf("pcnet_mmio_writew addr=0x" TARGET_FMT_plx " val=0x%04x\n", addr, - val); -#endif + + trace_pcnet_mmio_writew(opaque, addr, val); if (addr & 0x10) pcnet_ioport_writew(d, addr & 0x0f, val); else { @@ -182,6 +177,7 @@ static uint32_t pcnet_mmio_readw(void *opaque, hwaddr addr) { PCNetState *d = opaque; uint32_t val = -1; + if (addr & 0x10) val = pcnet_ioport_readw(d, addr & 0x0f); else { @@ -190,20 +186,15 @@ static uint32_t pcnet_mmio_readw(void *opaque, hwaddr addr) val <<= 8; val |= pcnet_aprom_readb(d, addr); } -#ifdef PCNET_DEBUG_IO - printf("pcnet_mmio_readw addr=0x" TARGET_FMT_plx" val = 0x%04x\n", addr, - val & 0xffff); -#endif + trace_pcnet_mmio_readw(opaque, addr, val); return val; } static void pcnet_mmio_writel(void *opaque, hwaddr addr, uint32_t val) { PCNetState *d = opaque; -#ifdef PCNET_DEBUG_IO - printf("pcnet_mmio_writel addr=0x" TARGET_FMT_plx" val=0x%08x\n", addr, - val); -#endif + + trace_pcnet_mmio_writel(opaque, addr, val); if (addr & 0x10) pcnet_ioport_writel(d, addr & 0x0f, val); else { @@ -219,6 +210,7 @@ static uint32_t pcnet_mmio_readl(void *opaque, hwaddr addr) { PCNetState *d = opaque; uint32_t val; + if (addr & 0x10) val = pcnet_ioport_readl(d, addr & 0x0f); else { @@ -231,10 +223,7 @@ static uint32_t pcnet_mmio_readl(void *opaque, hwaddr addr) val <<= 8; val |= pcnet_aprom_readb(d, addr); } -#ifdef PCNET_DEBUG_IO - printf("pcnet_mmio_readl addr=0x" TARGET_FMT_plx " val=0x%08x\n", addr, - val); -#endif + trace_pcnet_mmio_readl(opaque, addr, val); return val; } diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c index 8486b80bb7..7778b9ad47 100644 --- a/hw/net/pcnet.c +++ b/hw/net/pcnet.c @@ -40,6 +40,7 @@ #include "qemu/timer.h" #include "qemu/sockets.h" #include "sysemu/sysemu.h" +#include "trace.h" #include "pcnet.h" @@ -685,9 +686,7 @@ static void pcnet_bcr_writew(PCNetState *s, uint32_t rap, uint32_t val); static void pcnet_s_reset(PCNetState *s) { -#ifdef PCNET_DEBUG - printf("pcnet_s_reset\n"); -#endif + trace_pcnet_s_reset(s); s->rdra = 0; s->tdra = 0; @@ -760,9 +759,7 @@ static void pcnet_update_irq(PCNetState *s) s->csr[4] |= 0x0040; s->csr[0] |= 0x0080; isr = 1; -#ifdef PCNET_DEBUG - printf("pcnet user int\n"); -#endif + trace_pcnet_user_int(s); } #if 1 @@ -777,9 +774,7 @@ static void pcnet_update_irq(PCNetState *s) } if (isr != s->isr) { -#ifdef PCNET_DEBUG - printf("pcnet: INTA=%d\n", isr); -#endif + trace_pcnet_isr_change(s, isr, s->isr); } qemu_set_irq(s->irq, isr); s->isr = isr; @@ -791,9 +786,7 @@ static void pcnet_init(PCNetState *s) uint16_t padr[3], ladrf[4], mode; uint32_t rdra, tdra; -#ifdef PCNET_DEBUG - printf("pcnet_init init_addr=0x%08x\n", PHYSADDR(s,CSR_IADR(s))); -#endif + trace_pcnet_init(s, PHYSADDR(s, CSR_IADR(s))); if (BCR_SSIZE32(s)) { struct pcnet_initblk32 initblk; @@ -831,9 +824,7 @@ static void pcnet_init(PCNetState *s) tdra &= 0x00ffffff; } -#if defined(PCNET_DEBUG) - printf("rlen=%d tlen=%d\n", rlen, tlen); -#endif + trace_pcnet_rlen_tlen(s, rlen, tlen); CSR_RCVRL(s) = (rlen < 9) ? (1 << rlen) : 512; CSR_XMTRL(s) = (tlen < 9) ? (1 << tlen) : 512; @@ -852,11 +843,8 @@ static void pcnet_init(PCNetState *s) CSR_RCVRC(s) = CSR_RCVRL(s); CSR_XMTRC(s) = CSR_XMTRL(s); -#ifdef PCNET_DEBUG - printf("pcnet ss32=%d rdra=0x%08x[%d] tdra=0x%08x[%d]\n", - BCR_SSIZE32(s), - s->rdra, CSR_RCVRL(s), s->tdra, CSR_XMTRL(s)); -#endif + trace_pcnet_ss32_rdra_tdra(s, BCR_SSIZE32(s), + s->rdra, CSR_RCVRL(s), s->tdra, CSR_XMTRL(s)); s->csr[0] |= 0x0101; s->csr[0] &= ~0x0004; /* clear STOP bit */ diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index b7b87a60cf..2d1be06f41 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -2075,20 +2075,6 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s) "length to %d\n", txsize); } - if (!s->cplus_txbuffer) - { - /* out of memory */ - - DPRINTF("+++ C+ mode transmiter failed to reallocate %d bytes\n", - s->cplus_txbuffer_len); - - /* update tally counter */ - ++s->tally_counters.TxERR; - ++s->tally_counters.TxAbt; - - return 0; - } - /* append more data to the packet */ DPRINTF("+++ C+ mode transmit reading %d bytes from host memory at " diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b560459e83..812d03054d 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1625,7 +1625,7 @@ static int spapr_kvm_type(const char *vm_type) } /* - * Implementation of an interface to adjust firmware patch + * Implementation of an interface to adjust firmware path * for the bootindex property handling. */ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus, diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c index dc9e46a7b1..032ee1a5f1 100644 --- a/hw/ppc/spapr_vio.c +++ b/hw/ppc/spapr_vio.c @@ -648,7 +648,7 @@ int spapr_populate_vdevice(VIOsPAPRBus *bus, void *fdt) ret = 0; out: - free(qdevs); + g_free(qdevs); return ret; } diff --git a/hw/usb/desc-msos.c b/hw/usb/desc-msos.c index 334d1aea8d..32c3600df8 100644 --- a/hw/usb/desc-msos.c +++ b/hw/usb/desc-msos.c @@ -231,7 +231,7 @@ int usb_desc_msos(const USBDesc *desc, USBPacket *p, length = len; } memcpy(dest, buf, length); - free(buf); + g_free(buf); p->actual_length = length; return 0; diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 0b26bc68dd..c20f2d1fee 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -139,9 +139,7 @@ struct VMStateDescription { const VMStateSubsection *subsections; }; -#ifdef CONFIG_USER_ONLY extern const VMStateDescription vmstate_dummy; -#endif extern const VMStateInfo vmstate_info_bool; @@ -2070,10 +2070,6 @@ int kvm_insert_breakpoint(CPUState *cpu, target_ulong addr, } bp = g_malloc(sizeof(struct kvm_sw_breakpoint)); - if (!bp) { - return -ENOMEM; - } - bp->pc = addr; bp->use_count = 1; err = kvm_arch_insert_sw_breakpoint(cpu, bp); diff --git a/libcacard/Makefile b/libcacard/Makefile index 0e7903fcfb..b5eddff11e 100644 --- a/libcacard/Makefile +++ b/libcacard/Makefile @@ -19,6 +19,8 @@ vscclient$(EXESUF): libcacard/vscclient.o libcacard.la libcacard.la: LDFLAGS += -rpath $(libdir) -no-undefined \ -export-symbols $(SRC_PATH)/libcacard/libcacard.syms +# Prevent libcacard.so linking against the entire world of 3rd party libs +libcacard.la: LIBS = libcacard.la: $(libcacard-lobj-y) $(call LINK,$^) diff --git a/linux-user/main.c b/linux-user/main.c index cfa7d07b7a..d92702a734 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -315,7 +315,7 @@ void cpu_loop(CPUX86State *env) #endif case EXCP0B_NOSEG: case EXCP0C_STACK: - info.si_signo = SIGBUS; + info.si_signo = TARGET_SIGBUS; info.si_errno = 0; info.si_code = TARGET_SI_KERNEL; info._sifields._sigfault._addr = 0; @@ -329,7 +329,7 @@ void cpu_loop(CPUX86State *env) } else #endif { - info.si_signo = SIGSEGV; + info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; info.si_code = TARGET_SI_KERNEL; info._sifields._sigfault._addr = 0; @@ -337,7 +337,7 @@ void cpu_loop(CPUX86State *env) } break; case EXCP0E_PAGE: - info.si_signo = SIGSEGV; + info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; if (!(env->error_code & 1)) info.si_code = TARGET_SEGV_MAPERR; @@ -354,7 +354,7 @@ void cpu_loop(CPUX86State *env) #endif { /* division by zero */ - info.si_signo = SIGFPE; + info.si_signo = TARGET_SIGFPE; info.si_errno = 0; info.si_code = TARGET_FPE_INTDIV; info._sifields._sigfault._addr = env->eip; @@ -369,7 +369,7 @@ void cpu_loop(CPUX86State *env) } else #endif { - info.si_signo = SIGTRAP; + info.si_signo = TARGET_SIGTRAP; info.si_errno = 0; if (trapnr == EXCP01_DB) { info.si_code = TARGET_TRAP_BRKPT; @@ -389,7 +389,7 @@ void cpu_loop(CPUX86State *env) } else #endif { - info.si_signo = SIGSEGV; + info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; info.si_code = TARGET_SI_KERNEL; info._sifields._sigfault._addr = 0; @@ -397,7 +397,7 @@ void cpu_loop(CPUX86State *env) } break; case EXCP06_ILLOP: - info.si_signo = SIGILL; + info.si_signo = TARGET_SIGILL; info.si_errno = 0; info.si_code = TARGET_ILL_ILLOPN; info._sifields._sigfault._addr = env->eip; @@ -519,7 +519,7 @@ segv: end_exclusive(); /* We get the PC of the entry address - which is as good as anything, on a real kernel what you get depends on which mode it uses. */ - info.si_signo = SIGSEGV; + info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; /* XXX: check env->error_code */ info.si_code = TARGET_SEGV_MAPERR; @@ -696,7 +696,7 @@ void cpu_loop(CPUARMState *env) rc = EmulateAll(opcode, &ts->fpa, env); if (rc == 0) { /* illegal instruction */ - info.si_signo = SIGILL; + info.si_signo = TARGET_SIGILL; info.si_errno = 0; info.si_code = TARGET_ILL_ILLOPN; info._sifields._sigfault._addr = env->regs[15]; @@ -720,7 +720,7 @@ void cpu_loop(CPUARMState *env) //printf("fpsr 0x%x, arm_fpe 0x%x\n",fpsr,arm_fpe); if (fpsr & (arm_fpe << 16)) { /* exception enabled? */ - info.si_signo = SIGFPE; + info.si_signo = TARGET_SIGFPE; info.si_errno = 0; /* ordered by priority, least first */ @@ -844,7 +844,7 @@ void cpu_loop(CPUARMState *env) case EXCP_DATA_ABORT: addr = env->exception.vaddress; { - info.si_signo = SIGSEGV; + info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; /* XXX: check env->error_code */ info.si_code = TARGET_SEGV_MAPERR; @@ -1030,7 +1030,7 @@ void cpu_loop(CPUARMState *env) /* just indicate that signals should be handled asap */ break; case EXCP_UDEF: - info.si_signo = SIGILL; + info.si_signo = TARGET_SIGILL; info.si_errno = 0; info.si_code = TARGET_ILL_ILLOPN; info._sifields._sigfault._addr = env->pc; @@ -1043,7 +1043,7 @@ void cpu_loop(CPUARMState *env) /* fall through for segv */ case EXCP_PREFETCH_ABORT: case EXCP_DATA_ABORT: - info.si_signo = SIGSEGV; + info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; /* XXX: check env->error_code */ info.si_code = TARGET_SEGV_MAPERR; @@ -1123,7 +1123,7 @@ void cpu_loop(CPUUniCore32State *env) break; case UC32_EXCP_DTRAP: case UC32_EXCP_ITRAP: - info.si_signo = SIGSEGV; + info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; /* XXX: check env->error_code */ info.si_code = TARGET_SEGV_MAPERR; @@ -2672,7 +2672,7 @@ void cpu_loop(CPUOpenRISCState *env) break; case EXCP_BUSERR: qemu_log("\nBus error, exit, pc is %#x\n", env->pc); - gdbsig = SIGBUS; + gdbsig = TARGET_SIGBUS; break; case EXCP_DPF: case EXCP_IPF: @@ -2684,11 +2684,11 @@ void cpu_loop(CPUOpenRISCState *env) break; case EXCP_ALIGN: qemu_log("\nAlignment pc is %#x\n", env->pc); - gdbsig = SIGBUS; + gdbsig = TARGET_SIGBUS; break; case EXCP_ILLEGAL: qemu_log("\nIllegal instructionpc is %#x\n", env->pc); - gdbsig = SIGILL; + gdbsig = TARGET_SIGILL; break; case EXCP_INT: qemu_log("\nExternal interruptpc is %#x\n", env->pc); @@ -2699,7 +2699,7 @@ void cpu_loop(CPUOpenRISCState *env) break; case EXCP_RANGE: qemu_log("\nRange\n"); - gdbsig = SIGSEGV; + gdbsig = TARGET_SIGSEGV; break; case EXCP_SYSCALL: env->pc += 4; /* 0xc00; */ @@ -2717,7 +2717,7 @@ void cpu_loop(CPUOpenRISCState *env) break; case EXCP_TRAP: qemu_log("\nTrap\n"); - gdbsig = SIGTRAP; + gdbsig = TARGET_SIGTRAP; break; case EXCP_NR: qemu_log("\nNR\n"); @@ -2787,7 +2787,7 @@ void cpu_loop(CPUSH4State *env) break; case 0xa0: case 0xc0: - info.si_signo = SIGSEGV; + info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; info.si_code = TARGET_SEGV_MAPERR; info._sifields._sigfault._addr = env->tea; @@ -2818,7 +2818,7 @@ void cpu_loop(CPUCRISState *env) switch (trapnr) { case 0xaa: { - info.si_signo = SIGSEGV; + info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; /* XXX: check env->error_code */ info.si_code = TARGET_SEGV_MAPERR; @@ -2879,7 +2879,7 @@ void cpu_loop(CPUMBState *env) switch (trapnr) { case 0xaa: { - info.si_signo = SIGSEGV; + info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; /* XXX: check env->error_code */ info.si_code = TARGET_SEGV_MAPERR; @@ -2917,14 +2917,14 @@ void cpu_loop(CPUMBState *env) switch (env->sregs[SR_ESR] & 31) { case ESR_EC_DIVZERO: - info.si_signo = SIGFPE; + info.si_signo = TARGET_SIGFPE; info.si_errno = 0; info.si_code = TARGET_FPE_FLTDIV; info._sifields._sigfault._addr = 0; queue_signal(env, info.si_signo, &info); break; case ESR_EC_FPU: - info.si_signo = SIGFPE; + info.si_signo = TARGET_SIGFPE; info.si_errno = 0; if (env->sregs[SR_FSR] & FSR_IO) { info.si_code = TARGET_FPE_FLTINV; @@ -3003,7 +3003,7 @@ void cpu_loop(CPUM68KState *env) case EXCP_LINEF: case EXCP_UNSUPPORTED: do_sigill: - info.si_signo = SIGILL; + info.si_signo = TARGET_SIGILL; info.si_errno = 0; info.si_code = TARGET_ILL_ILLOPN; info._sifields._sigfault._addr = env->pc; @@ -3030,7 +3030,7 @@ void cpu_loop(CPUM68KState *env) break; case EXCP_ACCESS: { - info.si_signo = SIGSEGV; + info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; /* XXX: check env->error_code */ info.si_code = TARGET_SEGV_MAPERR; @@ -3337,12 +3337,12 @@ void cpu_loop(CPUS390XState *env) switch (n) { case PGM_OPERATION: case PGM_PRIVILEGED: - sig = SIGILL; + sig = TARGET_SIGILL; n = TARGET_ILL_ILLOPC; goto do_signal_pc; case PGM_PROTECTION: case PGM_ADDRESSING: - sig = SIGSEGV; + sig = TARGET_SIGSEGV; /* XXX: check env->error_code */ n = TARGET_SEGV_MAPERR; addr = env->__excp_addr; @@ -3352,16 +3352,16 @@ void cpu_loop(CPUS390XState *env) case PGM_SPECIAL_OP: case PGM_OPERAND: do_sigill_opn: - sig = SIGILL; + sig = TARGET_SIGILL; n = TARGET_ILL_ILLOPN; goto do_signal_pc; case PGM_FIXPT_OVERFLOW: - sig = SIGFPE; + sig = TARGET_SIGFPE; n = TARGET_FPE_INTOVF; goto do_signal_pc; case PGM_FIXPT_DIVIDE: - sig = SIGFPE; + sig = TARGET_SIGFPE; n = TARGET_FPE_INTDIV; goto do_signal_pc; @@ -3386,7 +3386,7 @@ void cpu_loop(CPUS390XState *env) /* ??? Quantum exception; BFP, DFP error. */ goto do_sigill_opn; } - sig = SIGFPE; + sig = TARGET_SIGFPE; goto do_signal_pc; } diff --git a/linux-user/syscall.c b/linux-user/syscall.c index d4398b9c56..5720195654 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1883,6 +1883,11 @@ static struct iovec *lock_iovec(int type, abi_ulong target_addr, return vec; fail: + while (--i >= 0) { + if (tswapal(target_vec[i].iov_len) > 0) { + unlock_user(vec[i].iov_base, tswapal(target_vec[i].iov_base), 0); + } + } unlock_user(target_vec, target_addr, 0); fail2: free(vec); @@ -1901,7 +1906,7 @@ static void unlock_iovec(struct iovec *vec, abi_ulong target_addr, if (target_vec) { for (i = 0; i < count; i++) { abi_ulong base = tswapal(target_vec[i].iov_base); - abi_long len = tswapal(target_vec[i].iov_base); + abi_long len = tswapal(target_vec[i].iov_len); if (len < 0) { break; } @@ -3571,6 +3576,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd, } default: ret = -TARGET_EINVAL; + unlock_user(argptr, guest_data, 0); goto out; } unlock_user(argptr, guest_data, 0); @@ -3690,6 +3696,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd, break; } default: + unlock_user(argptr, guest_data, 0); ret = -TARGET_EINVAL; goto out; } diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index ebb3be1196..9ed6de88ec 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -655,7 +655,14 @@ typedef struct { #endif #define TARGET_SI_MAX_SIZE 128 -#define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3) + +#if TARGET_ABI_BITS == 32 +#define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) +#else +#define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) +#endif + +#define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) typedef struct target_siginfo { #ifdef TARGET_MIPS diff --git a/migration/rdma.c b/migration/rdma.c index fc351eabf2..6bee30c6c1 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -121,7 +121,7 @@ enum { RDMA_WRID_RECV_CONTROL = 4000, }; -const char *wrid_desc[] = { +static const char *wrid_desc[] = { [RDMA_WRID_NONE] = "NONE", [RDMA_WRID_RDMA_WRITE] = "WRITE RDMA", [RDMA_WRID_SEND_CONTROL] = "CONTROL SEND", @@ -160,7 +160,7 @@ enum { RDMA_CONTROL_UNREGISTER_FINISHED, /* unpinning finished */ }; -const char *control_desc[] = { +static const char *control_desc[] = { [RDMA_CONTROL_NONE] = "NONE", [RDMA_CONTROL_ERROR] = "ERROR", [RDMA_CONTROL_READY] = "READY", @@ -1121,9 +1121,6 @@ static int qemu_rdma_register_and_get_keys(RDMAContext *rdma, /* allocate memory to store chunk MRs */ if (!block->pmr) { block->pmr = g_malloc0(block->nb_chunks * sizeof(struct ibv_mr *)); - if (!block->pmr) { - return -1; - } } /* @@ -3253,14 +3250,14 @@ static int qemu_rdma_get_fd(void *opaque) return rdma->comp_channel->fd; } -const QEMUFileOps rdma_read_ops = { +static const QEMUFileOps rdma_read_ops = { .get_buffer = qemu_rdma_get_buffer, .get_fd = qemu_rdma_get_fd, .close = qemu_rdma_close, .hook_ram_load = qemu_rdma_registration_handle, }; -const QEMUFileOps rdma_write_ops = { +static const QEMUFileOps rdma_write_ops = { .put_buffer = qemu_rdma_put_buffer, .close = qemu_rdma_close, .before_ram_iterate = qemu_rdma_registration_start, diff --git a/qemu-log.c b/qemu-log.c index 05b5493e0c..13f3813f68 100644 --- a/qemu-log.c +++ b/qemu-log.c @@ -111,7 +111,7 @@ const QEMULogItem qemu_log_items[] = { { CPU_LOG_PCALL, "pcall", "x86 only: show protected mode far calls/returns/exceptions" }, { CPU_LOG_RESET, "cpu_reset", - "x86 only: show CPU state before CPU resets" }, + "show CPU state before CPU resets" }, { CPU_LOG_IOPORT, "ioport", "show all i/o ports accesses" }, { LOG_UNIMP, "unimp", @@ -4,7 +4,7 @@ * Copyright Alexander Graf * * Authors: - * Alexander Graf <agraf@suse.de + * Alexander Graf <agraf@suse.de> * * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING.LIB file in the top-level directory. diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py index b8b9968e00..0c8b22f2aa 100755 --- a/scripts/analyze-migration.py +++ b/scripts/analyze-migration.py @@ -247,7 +247,7 @@ class HTABSection(object): if index == 0 and n_valid == 0 and n_invalid == 0: break - self.file.readvar(n_valid * HASH_PTE_SIZE_64) + self.file.readvar(n_valid * self.HASH_PTE_SIZE_64) def getDict(self): return "" diff --git a/spice-qemu-char.c b/spice-qemu-char.c index 7e0d300777..a4f4e578fe 100644 --- a/spice-qemu-char.c +++ b/spice-qemu-char.c @@ -158,7 +158,7 @@ static gboolean spice_char_source_dispatch(GSource *source, return func(NULL, G_IO_OUT, user_data); } -GSourceFuncs SpiceCharSourceFuncs = { +static GSourceFuncs SpiceCharSourceFuncs = { .prepare = spice_char_source_prepare, .check = spice_char_source_check, .dispatch = spice_char_source_dispatch, diff --git a/stubs/qtest.c b/stubs/qtest.c index e671ed8e8e..dc17594bb6 100644 --- a/stubs/qtest.c +++ b/stubs/qtest.c @@ -8,7 +8,7 @@ * See the COPYING file in the top-level directory. */ -#include "qemu-common.h" +#include "sysemu/qtest.h" /* Needed for qtest_allowed() */ bool qtest_allowed; diff --git a/target-mips/translate.c b/target-mips/translate.c index e9d86b2364..1faeb5d740 100644 --- a/target-mips/translate.c +++ b/target-mips/translate.c @@ -18729,6 +18729,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx) case OPC_SWL: case OPC_SWR: check_insn_opc_removed(ctx, ISA_MIPS32R6); + /* fall through */ case OPC_SB ... OPC_SH: case OPC_SW: gen_st(ctx, op, rt, rs, imm); @@ -18817,6 +18818,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx) case OPC_PS_FMT: check_cp1_enabled(ctx); check_insn_opc_removed(ctx, ISA_MIPS32R6); + /* fall through */ case OPC_S_FMT: case OPC_D_FMT: check_cp1_enabled(ctx); @@ -19000,6 +19002,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx) case OPC_LDL ... OPC_LDR: case OPC_LLD: check_insn_opc_removed(ctx, ISA_MIPS32R6); + /* fall through */ case OPC_LWU: case OPC_LD: check_insn(ctx, ISA_MIPS3); @@ -19008,6 +19011,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx) break; case OPC_SDL ... OPC_SDR: check_insn_opc_removed(ctx, ISA_MIPS32R6); + /* fall through */ case OPC_SD: check_insn(ctx, ISA_MIPS3); check_mips_64(ctx); diff --git a/target-moxie/machine.c b/target-moxie/machine.c index da1a8572a8..b9316f0ec3 100644 --- a/target-moxie/machine.c +++ b/target-moxie/machine.c @@ -1,5 +1,6 @@ #include "hw/hw.h" #include "hw/boards.h" +#include "machine.h" const VMStateDescription vmstate_moxie_cpu = { .name = "cpu", diff --git a/trace-events b/trace-events index 57f357f7f7..f87b077805 100644 --- a/trace-events +++ b/trace-events @@ -203,6 +203,10 @@ hd_geometry_guess(void *blk, uint32_t cyls, uint32_t heads, uint32_t secs, int t jazz_led_read(uint64_t addr, uint8_t val) "read addr=0x%"PRIx64": 0x%x" jazz_led_write(uint64_t addr, uint8_t new) "write addr=0x%"PRIx64": 0x%x" +# hw/display/xenfb.c +xenfb_mouse_event(void *opaque, int dx, int dy, int dz, int button_state, int abs_pointer_wanted) "%p x %d y %d z %d bs %#x abs %d" +xenfb_input_connected(void *xendev, int abs_pointer_wanted) "%p abs %d" + # hw/net/lance.c lance_mem_readw(uint64_t addr, uint32_t ret) "addr=%"PRIx64"val=0x%04x" lance_mem_writew(uint64_t addr, uint32_t val) "addr=%"PRIx64"val=0x%04x" @@ -221,6 +225,23 @@ slavio_check_interrupts(uint32_t pending, uint32_t intregm_disabled) "pending %x slavio_set_irq(uint32_t target_cpu, int irq, uint32_t pil, int level) "Set cpu %d irq %d -> pil %d level %d" slavio_set_timer_irq_cpu(int cpu, int level) "Set cpu %d local timer level %d" +# hw/input/ps2.c +ps2_put_keycode(void *opaque, int keycode) "%p keycode %d" +ps2_read_data(void *opaque) "%p" +ps2_set_ledstate(void *s, int ledstate) "%p ledstate %d" +ps2_reset_keyboard(void *s) "%p" +ps2_write_keyboard(void *opaque, int val) "%p val %d" +ps2_keyboard_set_translation(void *opaque, int mode) "%p mode %d" +ps2_mouse_send_packet(void *s, int dx1, int dy1, int dz1, int b) "%p x %d y %d z %d bs %#x" +ps2_mouse_event_disabled(void *opaque, int dx, int dy, int dz, int buttons_state, int mouse_dx, int mouse_dy, int mouse_dz) "%p x %d y %d z %d bs %#x mx %d my %d mz %d " +ps2_mouse_event(void *opaque, int dx, int dy, int dz, int buttons_state, int mouse_dx, int mouse_dy, int mouse_dz) "%p x %d y %d z %d bs %#x mx %d my %d mz %d " +ps2_mouse_fake_event(void *opaque) "%p" +ps2_write_mouse(void *opaque, int val) "%p val %d" +ps2_kbd_reset(void *opaque) "%p" +ps2_mouse_reset(void *opaque) "%p" +ps2_kbd_init(void *s) "%p" +ps2_mouse_init(void *s) "%p" + # hw/misc/slavio_misc.c slavio_misc_update_irq_raise(void) "Raise IRQ" slavio_misc_update_irq_lower(void) "Lower IRQ" @@ -1261,6 +1282,26 @@ spapr_pci_msi_retry(unsigned config_addr, unsigned req_num, unsigned max_irqs) " pci_update_mappings_del(void *d, uint32_t bus, uint32_t func, uint32_t slot, int bar, uint64_t addr, uint64_t size) "d=%p %02x:%02x.%x %d,%#"PRIx64"+%#"PRIx64 pci_update_mappings_add(void *d, uint32_t bus, uint32_t func, uint32_t slot, int bar, uint64_t addr, uint64_t size) "d=%p %02x:%02x.%x %d,%#"PRIx64"+%#"PRIx64 +# hw/net/pcnet.c +pcnet_s_reset(void *s) "s=%p" +pcnet_user_int(void *s) "s=%p" +pcnet_isr_change(void *s, uint32_t isr, uint32_t isr_old) "s=%p INTA=%d<=%d" +pcnet_init(void *s, uint64_t init_addr) "s=%p init_addr=%#"PRIx64 +pcnet_rlen_tlen(void *s, uint32_t rlen, uint32_t tlen) "s=%p rlen=%d tlen=%d" +pcnet_ss32_rdra_tdra(void *s, uint32_t ss32, uint32_t rdra, uint32_t rcvrl, uint32_t tdra, uint32_t xmtrl) "s=%p ss32=%d rdra=0x%08x[%d] tdra=0x%08x[%d]" + +# hw/net/pcnet-pci.c +pcnet_aprom_writeb(void *opaque, uint32_t addr, uint32_t val) "opaque=%p addr=0x%08x val=0x%02x" +pcnet_aprom_readb(void *opaque, uint32_t addr, uint32_t val) "opaque=%p addr=0x%08x val=0x%02x" +pcnet_ioport_read(void *opaque, uint64_t addr, unsigned size) "opaque=%p addr=%#"PRIx64" size=%d" +pcnet_ioport_write(void *opaque, uint64_t addr, uint64_t data, unsigned size) "opaque=%p addr=%#"PRIx64" data=%#"PRIx64" size=%d" +pcnet_mmio_writeb(void *opaque, uint64_t addr, uint32_t val) "opaque=%p addr=%#"PRIx64" val=0x%x" +pcnet_mmio_writew(void *opaque, uint64_t addr, uint32_t val) "opaque=%p addr=%#"PRIx64" val=0x%x" +pcnet_mmio_writel(void *opaque, uint64_t addr, uint32_t val) "opaque=%p addr=%#"PRIx64" val=0x%x" +pcnet_mmio_readb(void *opaque, uint64_t addr, uint32_t val) "opaque=%p addr=%#"PRIx64" val=0x%x" +pcnet_mmio_readw(void *opaque, uint64_t addr, uint32_t val) "opaque=%p addr=%#"PRIx64" val=0x%x" +pcnet_mmio_readl(void *opaque, uint64_t addr, uint32_t val) "opaque=%p addr=%#"PRIx64" val=0x%x" + # hw/intc/xics.c xics_icp_check_ipi(int server, uint8_t mfrr) "CPU %d can take IPI mfrr=%#x" xics_icp_accept(uint32_t old_xirr, uint32_t new_xirr) "icp_accept: XIRR %#"PRIx32"->%#"PRIx32 diff --git a/translate-all.c b/translate-all.c index 4a1b64fd83..9f47ce7f71 100644 --- a/translate-all.c +++ b/translate-all.c @@ -631,7 +631,7 @@ static inline void *alloc_code_gen_buffer(void) #else static inline void *alloc_code_gen_buffer(void) { - void *buf = g_malloc(tcg_ctx.code_gen_buffer_size); + void *buf = g_try_malloc(tcg_ctx.code_gen_buffer_size); if (buf == NULL) { return NULL; @@ -659,10 +659,6 @@ void buffer_reserve(Buffer *buffer, size_t len) if ((buffer->capacity - buffer->offset) < len) { buffer->capacity += (len + 1024); buffer->buffer = g_realloc(buffer->buffer, buffer->capacity); - if (buffer->buffer == NULL) { - fprintf(stderr, "vnc: out of memory\n"); - exit(1); - } } } diff --git a/util/aes.c b/util/aes.c index 6058f1950b..3d7c4be9b6 100644 --- a/util/aes.c +++ b/util/aes.c @@ -1161,7 +1161,7 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits, rk += 8; } } - return 0; + abort(); } /** diff --git a/util/qemu-option.c b/util/qemu-option.c index a708241643..d3ab65d24f 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -213,7 +213,7 @@ void parse_option_size(const char *name, const char *value, bool has_help_option(const char *param) { size_t buflen = strlen(param) + 1; - char *buf = g_malloc0(buflen); + char *buf = g_malloc(buflen); const char *p = param; bool result = false; @@ -230,14 +230,14 @@ bool has_help_option(const char *param) } out: - free(buf); + g_free(buf); return result; } bool is_valid_option_list(const char *param) { size_t buflen = strlen(param) + 1; - char *buf = g_malloc0(buflen); + char *buf = g_malloc(buflen); const char *p = param; bool result = true; @@ -255,7 +255,7 @@ bool is_valid_option_list(const char *param) } out: - free(buf); + g_free(buf); return result; } diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index a76bb3c913..61fc3c1364 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -512,7 +512,7 @@ InetSocketAddress *inet_parse(const char *str, Error **errp) { InetSocketAddress *addr; const char *optstr, *h; - char host[64]; + char host[65]; char port[33]; int to; int pos; @@ -694,7 +694,7 @@ int unix_listen_opts(QemuOpts *opts, Error **errp) sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (sock < 0) { - error_setg_errno(errp, errno, "Failed to create socket"); + error_setg_errno(errp, errno, "Failed to create Unix socket"); return -1; } @@ -703,9 +703,15 @@ int unix_listen_opts(QemuOpts *opts, Error **errp) if (path && strlen(path)) { snprintf(un.sun_path, sizeof(un.sun_path), "%s", path); } else { - char *tmpdir = getenv("TMPDIR"); - snprintf(un.sun_path, sizeof(un.sun_path), "%s/qemu-socket-XXXXXX", - tmpdir ? tmpdir : "/tmp"); + const char *tmpdir = getenv("TMPDIR"); + tmpdir = tmpdir ? tmpdir : "/tmp"; + if (snprintf(un.sun_path, sizeof(un.sun_path), "%s/qemu-socket-XXXXXX", + tmpdir) >= sizeof(un.sun_path)) { + error_setg_errno(errp, errno, + "TMPDIR environment variable (%s) too large", tmpdir); + goto err; + } + /* * This dummy fd usage silences the mktemp() unsecure warning. * Using mkstemp() doesn't make things more secure here @@ -713,13 +719,19 @@ int unix_listen_opts(QemuOpts *opts, Error **errp) * to unlink first and thus re-open the race window. The * worst case possible is bind() failing, i.e. a DoS attack. */ - fd = mkstemp(un.sun_path); close(fd); + fd = mkstemp(un.sun_path); + if (fd < 0) { + error_setg_errno(errp, errno, + "Failed to make a temporary socket name in %s", tmpdir); + goto err; + } + close(fd); qemu_opt_set(opts, "path", un.sun_path); } unlink(un.sun_path); if (bind(sock, (struct sockaddr*) &un, sizeof(un)) < 0) { - error_setg_errno(errp, errno, "Failed to bind socket"); + error_setg_errno(errp, errno, "Failed to bind socket to %s", un.sun_path); goto err; } if (listen(sock, 1) < 0) { diff --git a/util/uri.c b/util/uri.c index 918d23516d..1cfd78bdb5 100644 --- a/util/uri.c +++ b/util/uri.c @@ -928,12 +928,10 @@ uri_parse(const char *str) { if (str == NULL) return(NULL); uri = uri_new(); - if (uri != NULL) { - ret = rfc3986_parse_uri_reference(uri, str); - if (ret) { - uri_free(uri); - return(NULL); - } + ret = rfc3986_parse_uri_reference(uri, str); + if (ret) { + uri_free(uri); + return(NULL); } return(uri); } @@ -974,15 +972,13 @@ uri_parse_raw(const char *str, int raw) { if (str == NULL) return(NULL); uri = uri_new(); - if (uri != NULL) { - if (raw) { - uri->cleanup |= 2; - } - ret = uri_parse_into(uri, str); - if (ret) { - uri_free(uri); - return(NULL); - } + if (raw) { + uri->cleanup |= 2; + } + ret = uri_parse_into(uri, str); + if (ret) { + uri_free(uri); + return(NULL); } return(uri); } @@ -1053,14 +1049,12 @@ uri_to_string(URI *uri) { while (*p != 0) { if (len >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } ret[len++] = *p++; } if (len >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } ret[len++] = ':'; @@ -1070,7 +1064,6 @@ uri_to_string(URI *uri) { while (*p != 0) { if (len + 3 >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } if (IS_RESERVED(*(p)) || IS_UNRESERVED(*(p))) @@ -1087,7 +1080,6 @@ uri_to_string(URI *uri) { if (uri->server != NULL) { if (len + 3 >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } ret[len++] = '/'; @@ -1097,7 +1089,6 @@ uri_to_string(URI *uri) { while (*p != 0) { if (len + 3 >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } if ((IS_UNRESERVED(*(p))) || @@ -1116,7 +1107,6 @@ uri_to_string(URI *uri) { } if (len + 3 >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } ret[len++] = '@'; @@ -1125,7 +1115,6 @@ uri_to_string(URI *uri) { while (*p != 0) { if (len >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } ret[len++] = *p++; @@ -1133,7 +1122,6 @@ uri_to_string(URI *uri) { if (uri->port > 0) { if (len + 10 >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } len += snprintf(&ret[len], max - len, ":%d", uri->port); @@ -1141,7 +1129,6 @@ uri_to_string(URI *uri) { } else if (uri->authority != NULL) { if (len + 3 >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } ret[len++] = '/'; @@ -1150,7 +1137,6 @@ uri_to_string(URI *uri) { while (*p != 0) { if (len + 3 >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } if ((IS_UNRESERVED(*(p))) || @@ -1169,7 +1155,6 @@ uri_to_string(URI *uri) { } else if (uri->scheme != NULL) { if (len + 3 >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } ret[len++] = '/'; @@ -1189,7 +1174,6 @@ uri_to_string(URI *uri) { (!strcmp(uri->scheme, "file"))) { if (len + 3 >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } ret[len++] = *p++; @@ -1199,7 +1183,6 @@ uri_to_string(URI *uri) { while (*p != 0) { if (len + 3 >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } if ((IS_UNRESERVED(*(p))) || ((*(p) == '/')) || @@ -1219,7 +1202,6 @@ uri_to_string(URI *uri) { if (uri->query != NULL) { if (len + 1 >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } ret[len++] = '?'; @@ -1227,7 +1209,6 @@ uri_to_string(URI *uri) { while (*p != 0) { if (len + 1 >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } ret[len++] = *p++; @@ -1237,7 +1218,6 @@ uri_to_string(URI *uri) { if (uri->fragment != NULL) { if (len + 3 >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } ret[len++] = '#'; @@ -1245,7 +1225,6 @@ uri_to_string(URI *uri) { while (*p != 0) { if (len + 3 >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p)))) @@ -1261,15 +1240,10 @@ uri_to_string(URI *uri) { } if (len >= max) { temp = realloc2n(ret, &max); - if (temp == NULL) goto mem_error; ret = temp; } ret[len] = 0; return(ret); - -mem_error: - g_free(ret); - return(NULL); } /** @@ -1675,8 +1649,6 @@ uri_resolve(const char *uri, const char *base) { else { if (*uri) { ref = uri_new(); - if (ref == NULL) - goto done; ret = uri_parse_into(ref, uri); } else @@ -1695,8 +1667,6 @@ uri_resolve(const char *uri, const char *base) { ret = -1; else { bas = uri_new(); - if (bas == NULL) - goto done; ret = uri_parse_into(bas, base); } if (ret != 0) { @@ -1727,8 +1697,6 @@ uri_resolve(const char *uri, const char *base) { * document. */ res = uri_new(); - if (res == NULL) - goto done; if ((ref->scheme == NULL) && (ref->path == NULL) && ((ref->authority == NULL) && (ref->server == NULL))) { res->scheme = g_strdup(bas->scheme); @@ -1933,8 +1901,6 @@ uri_resolve_relative (const char *uri, const char * base) * First parse URI into a standard form */ ref = uri_new (); - if (ref == NULL) - return NULL; /* If URI not already in "relative" form */ if (uri[0] != '.') { ret = uri_parse_into (ref, uri); @@ -1951,8 +1917,6 @@ uri_resolve_relative (const char *uri, const char * base) goto done; } bas = uri_new (); - if (bas == NULL) - goto done; if (base[0] != '.') { ret = uri_parse_into (bas, base); if (ret != 0) @@ -1971,7 +1935,8 @@ uri_resolve_relative (const char *uri, const char * base) val = g_strdup (uri); goto done; } - if (!strcmp(bas->path, ref->path)) { + if (bas->path == ref->path || + (bas->path && ref->path && !strcmp(bas->path, ref->path))) { val = g_strdup(""); goto done; } @@ -2195,6 +2195,7 @@ static int mon_init_func(QemuOpts *opts, void *opaque) static void monitor_parse(const char *optarg, const char *mode, bool pretty) { static int monitor_device_index = 0; + Error *local_err = NULL; QemuOpts *opts; const char *p; char label[32]; @@ -2215,9 +2216,10 @@ static void monitor_parse(const char *optarg, const char *mode, bool pretty) } } - opts = qemu_opts_create(qemu_find_opts("mon"), label, 1, NULL); + opts = qemu_opts_create(qemu_find_opts("mon"), label, 1, &local_err); if (!opts) { - fprintf(stderr, "duplicate chardev: %s\n", label); + error_report("%s", error_get_pretty(local_err)); + error_free(local_err); exit(1); } qemu_opt_set(opts, "mode", mode); @@ -2450,6 +2452,7 @@ static gint machine_class_cmp(gconstpointer a, gconstpointer b) mc = find_machine(name); } if (mc) { + g_slist_free(machines); return mc; } if (name && !is_help_option(name)) { |