From 5c765e7af6c830fe8ccfc1b58a908e410f6d400c Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Tue, 1 Nov 2016 18:03:02 +0100 Subject: hw/block/m25p80: Fix typo in local macro name Signed-off-by: Stefan Weil Signed-off-by: Michael Tokarev --- hw/block/m25p80.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hw') diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index e904514..2d6eb46 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -147,7 +147,7 @@ typedef struct FlashPartInfo { #define CFG_DUMMY_CLK_LEN 4 #define NVCFG_DUMMY_CLK_POS 12 #define VCFG_DUMMY_CLK_POS 4 -#define EVCFG_OUT_DRIVER_STRENGHT_DEF 7 +#define EVCFG_OUT_DRIVER_STRENGTH_DEF 7 #define EVCFG_VPP_ACCELERATOR (1 << 3) #define EVCFG_RESET_HOLD_ENABLED (1 << 4) #define NVCFG_DUAL_IO_MASK (1 << 2) @@ -747,7 +747,7 @@ static void reset_memory(Flash *s) ); s->enh_volatile_cfg = 0; - s->enh_volatile_cfg |= EVCFG_OUT_DRIVER_STRENGHT_DEF; + s->enh_volatile_cfg |= EVCFG_OUT_DRIVER_STRENGTH_DEF; s->enh_volatile_cfg |= EVCFG_VPP_ACCELERATOR; s->enh_volatile_cfg |= EVCFG_RESET_HOLD_ENABLED; if (s->nonvolatile_cfg & NVCFG_DUAL_IO_MASK) { -- cgit v1.1 From b12227afb1c6533ee4950ffb067ecf638ec7bcce Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 19 Nov 2016 20:29:26 +0100 Subject: hw: Fix typos found by codespell Signed-off-by: Stefan Weil Acked-by: Alistair Francis Signed-off-by: Michael Tokarev --- hw/core/generic-loader.c | 4 ++-- hw/core/qdev-properties.c | 2 +- hw/display/xlnx_dp.c | 4 ++-- hw/i386/pc.c | 2 +- hw/net/cadence_gem.c | 2 +- hw/net/spapr_llan.c | 4 ++-- hw/ppc/spapr_drc.c | 2 +- hw/s390x/s390-pci-bus.h | 4 ++-- hw/usb/dev-mtp.c | 2 +- hw/vfio/pci-quirks.c | 2 +- hw/virtio/virtio-crypto.c | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) (limited to 'hw') diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c index 208f549..58f1f02 100644 --- a/hw/core/generic-loader.c +++ b/hw/core/generic-loader.c @@ -27,7 +27,7 @@ * this it needs a backend to manage the datas, the same as other * memory-related devices. In this case as the backend is so trivial we * have merged it with the frontend instead of creating and maintaining a - * seperate backend. + * separate backend. */ #include "qemu/osdep.h" @@ -79,7 +79,7 @@ static void generic_loader_realize(DeviceState *dev, Error **errp) "loading memory values"); return; } else if (!s->data_len) { - /* We cant' check for !data here as a value of 0 is still valid. */ + /* We can't check for !data here as a value of 0 is still valid. */ error_setg(errp, "Both data and data-len must be specified"); return; } else if (s->data_len > 8) { diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 2a82768..6ab4265 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -711,7 +711,7 @@ static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name, /* * Catch "invalid" device reference from vfio-pci and allow the - * default buffer representing the non-existant device to be used. + * default buffer representing the non-existent device to be used. */ if (~addr->domain || ~addr->bus || ~addr->slot || ~addr->function) { rc = snprintf(buffer, sizeof(buffer), "%04x:%02x:%02x.%0d", diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index f43eb09..f7b7b80 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -555,7 +555,7 @@ static void xlnx_dp_recreate_surface(XlnxDPState *s) if ((width != 0) && (height != 0)) { /* * As dpy_gfx_replace_surface calls qemu_free_displaysurface on the - * surface we need to be carefull and don't free the surface associated + * surface we need to be careful and don't free the surface associated * to the console or double free will happen. */ if (s->bout_plane.surface != current_console_surface) { @@ -1160,7 +1160,7 @@ static void xlnx_dp_update_display(void *opaque) */ if (!xlnx_dpdma_start_operation(s->dpdma, 3, false)) { /* - * An error occured don't do anything with the data.. + * An error occurred don't do anything with the data.. * Trigger an underflow interrupt. */ s->core_registers[DP_INT_STATUS] |= (1 << 21); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c949cf0..706e233 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1777,7 +1777,7 @@ static int pc_apic_cmp(const void *a, const void *b) /* returns pointer to CPUArchId descriptor that matches CPU's apic_id * in pcms->possible_cpus->cpus, if pcms->possible_cpus->cpus has no - * entry correponding to CPU's apic_id returns NULL. + * entry corresponding to CPU's apic_id returns NULL. */ static CPUArchId *pc_find_cpu_slot(PCMachineState *pcms, CPUState *cpu, int *idx) diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index 7915732..e99d454 100644 --- a/hw/net/cadence_gem.c +++ b/hw/net/cadence_gem.c @@ -896,7 +896,7 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) DB_PRINT("config bufsize: %d packet size: %ld\n", rxbufsize, size); - /* Find which queue we are targetting */ + /* Find which queue we are targeting */ q = get_queue_from_screen(s, rxbuf_ptr, rxbufsize); while (bytes_to_copy) { diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c index 01ecb02..058908d 100644 --- a/hw/net/spapr_llan.c +++ b/hw/net/spapr_llan.c @@ -105,7 +105,7 @@ typedef struct VIOsPAPRVLANDevice { uint32_t add_buf_ptr, use_buf_ptr, rx_bufs; hwaddr rxq_ptr; QEMUTimer *rxp_timer; - uint32_t compat_flags; /* Compatability flags for migration */ + uint32_t compat_flags; /* Compatibility flags for migration */ RxBufPool *rx_pool[RX_MAX_POOLS]; /* Receive buffer descriptor pools */ } VIOsPAPRVLANDevice; @@ -559,7 +559,7 @@ static target_long spapr_vlan_add_rxbuf_to_pool(VIOsPAPRVLANDevice *dev, if (pool < 0) { /* * No matching pool found? Try to use a new one. If the guest used all - * pools before, but changed the size of one pool inbetween, we might + * pools before, but changed the size of one pool in the meantime, we might * need to recycle that pool here (if it's empty already). Thus scan * all buffer pools now, starting with the last (likely empty) one. */ diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index a0c44ee..2de6377 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -59,7 +59,7 @@ static uint32_t set_isolation_state(sPAPRDRConnector *drc, trace_spapr_drc_set_isolation_state(get_index(drc), state); if (state == SPAPR_DR_ISOLATION_STATE_UNISOLATED) { - /* cannot unisolate a non-existant resource, and, or resources + /* cannot unisolate a non-existent resource, and, or resources * which are in an 'UNUSABLE' allocation state. (PAPR 2.7, 13.5.3.5) */ if (!drc->dev || diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h index b0adefa..0aad9cc 100644 --- a/hw/s390x/s390-pci-bus.h +++ b/hw/s390x/s390-pci-bus.h @@ -183,8 +183,8 @@ enum ZpciIoatDtype { * may enter an error state * blocked: ignore all DMA and interrupts; transition back to enabled or from * error state via mpcifc - * error: an error occured; transition back to enabled via mpcifc - * permanent error: an unrecoverable error occured; transition to standby via + * error: an error occurred; transition back to enabled via mpcifc + * permanent error: an unrecoverable error occurred; transition to standby via * sclp deconfigure */ typedef enum { diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 9cb0f50..809dcf5 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -1093,7 +1093,7 @@ static MTPData *usb_mtp_get_object_prop_value(MTPState *s, MTPControl *c, } break; case PROP_PERSISTENT_UNIQUE_OBJECT_IDENTIFIER: - /* Should be persistant between sessions, + /* Should be persistent between sessions, * but using our objedt ID is "good enough" * for now */ usb_mtp_add_u64(d, 0x0000000000000000); diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 811eecd..6c771f7 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1171,7 +1171,7 @@ static int vfio_pci_igd_host_init(VFIOPCIDevice *vdev, * IGD LPC/ISA bridge support code. The vBIOS needs this, but we can't write * arbitrary values into just any bridge, so we must create our own. We try * to handle if the user has created it for us, which they might want to do - * to enable multifuction so we don't occupy the whole PCI slot. + * to enable multifunction so we don't occupy the whole PCI slot. */ static void vfio_pci_igd_lpc_bridge_realize(PCIDevice *pdev, Error **errp) { diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c index 296472f..0353eb6 100644 --- a/hw/virtio/virtio-crypto.c +++ b/hw/virtio/virtio-crypto.c @@ -786,7 +786,7 @@ static void virtio_crypto_device_realize(DeviceState *dev, Error **errp) vcrypto->max_queues = MAX(vcrypto->cryptodev->conf.peers.queues, 1); if (vcrypto->max_queues + 1 > VIRTIO_QUEUE_MAX) { error_setg(errp, "Invalid number of queues (= %" PRIu32 "), " - "must be a postive integer less than %d.", + "must be a positive integer less than %d.", vcrypto->max_queues, VIRTIO_QUEUE_MAX); return; } -- cgit v1.1 From d62d1eb627bc9b10b26fabda5d643e3b77cb54dd Mon Sep 17 00:00:00 2001 From: Cao jin Date: Fri, 11 Nov 2016 11:02:48 +0800 Subject: pcie: fix typo in comments Signed-off-by: Cao jin Signed-off-by: Michael Tokarev --- hw/pci/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw') diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index adeda04..cbd4bb4 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -656,7 +656,7 @@ static void pcie_ext_cap_set_next(PCIDevice *dev, uint16_t pos, uint16_t next) } /* - * caller must supply valid (offset, size) * such that the range shouldn't + * Caller must supply valid (offset, size) such that the range wouldn't * overlap with other capability or other registers. * This function doesn't check it. */ -- cgit v1.1 From 9ed2690354e65a87b830f197cac0138e842f989e Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 4 Jan 2017 16:05:25 +0100 Subject: pci-assign: avoid pointless stat Just check the errno value after fopen and follow it with fstat. This shuts up Coverity's complaint about TOC/TOU violation. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- hw/i386/pci-assign-load-rom.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'hw') diff --git a/hw/i386/pci-assign-load-rom.c b/hw/i386/pci-assign-load-rom.c index 0d8e4b2..fd59076 100644 --- a/hw/i386/pci-assign-load-rom.c +++ b/hw/i386/pci-assign-load-rom.c @@ -39,19 +39,19 @@ void *pci_assign_dev_load_option_rom(PCIDevice *dev, struct Object *owner, "/sys/bus/pci/devices/%04x:%02x:%02x.%01x/rom", domain, bus, slot, function); - if (stat(rom_file, &st)) { - if (errno != ENOENT) { - error_report("pci-assign: Invalid ROM."); - } - return NULL; - } - /* Write "1" to the ROM file to enable it */ fp = fopen(rom_file, "r+"); if (fp == NULL) { - error_report("pci-assign: Cannot open %s: %s", rom_file, strerror(errno)); + if (errno != ENOENT) { + error_report("pci-assign: Cannot open %s: %s", rom_file, strerror(errno)); + } return NULL; } + if (fstat(fileno(fp), &st) == -1) { + error_report("pci-assign: Cannot stat %s: %s", rom_file, strerror(errno)); + goto close_rom; + } + val = 1; if (fwrite(&val, 1, 1, fp) != 1) { goto close_rom; -- cgit v1.1 From a1f910875668d87e139e79fce38e9c2e1c3747dd Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Mon, 9 Jan 2017 17:05:21 +0000 Subject: hw/i386/kvmvapic: Remove dead code in patch_hypercalls() The patch_hypercalls() function sets up a 'patches' variable and checks it at the end of the function, but never modifies it in the middle. Remove this dead code, which seems to have been present since the function was added in commit e5ad936b0fd7 in 2012. (Spotted by Coverity: CID 1005581.) Signed-off-by: Peter Maydell Acked-by: Jan Kiszka Signed-off-by: Michael Tokarev --- hw/i386/kvmvapic.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'hw') diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c index 2f767b6..702e281 100644 --- a/hw/i386/kvmvapic.c +++ b/hw/i386/kvmvapic.c @@ -535,7 +535,6 @@ static int patch_hypercalls(VAPICROMState *s) uint8_t alternates[2]; const uint8_t *pattern; const uint8_t *patch; - int patches = 0; off_t pos; uint8_t *rom; @@ -566,11 +565,6 @@ static int patch_hypercalls(VAPICROMState *s) } g_free(rom); - - if (patches != 0 && patches != 2) { - return -1; - } - return 0; } -- cgit v1.1 From 4382fa6554987d8c10cdd0fafb04191a40c9743e Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 6 Jan 2017 17:45:14 +0000 Subject: lm32: milkymist-tmu2: fix another integer overflow Don't truncate the multiplication and do a 64 bit one instead because the result is stored in a 64 bit variable. This fixes a similar coverity warning to commit 237a8650d640, in a similar way, and is the other half of the fix for coverity CID 1167561. Signed-off-by: Peter Maydell Acked-by: Michael Walle Signed-off-by: Michael Tokarev --- hw/display/milkymist-tmu2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw') diff --git a/hw/display/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c index 5c666f9..920374b 100644 --- a/hw/display/milkymist-tmu2.c +++ b/hw/display/milkymist-tmu2.c @@ -257,7 +257,7 @@ static void tmu2_start(MilkymistTMU2State *s) glColor4f(m, m, m, (float)(s->regs[R_ALPHA] + 1) / 64.0f); /* Read the QEMU dest. framebuffer into the OpenGL framebuffer */ - fb_len = 2 * s->regs[R_DSTHRES] * s->regs[R_DSTVRES]; + fb_len = 2ULL * s->regs[R_DSTHRES] * s->regs[R_DSTVRES]; fb = cpu_physical_memory_map(s->regs[R_DSTFBUF], &fb_len, 0); if (fb == NULL) { glDeleteTextures(1, &texture); -- cgit v1.1 From 8907379204807b8047e710ae76c4d6849c3f6ce1 Mon Sep 17 00:00:00 2001 From: Cao jin Date: Fri, 11 Nov 2016 11:01:36 +0800 Subject: vfio: remove a duplicated word in comments Signed-off-by: Cao jin Signed-off-by: Michael Tokarev --- hw/vfio/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hw') diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index d7dbe0e..882d3a9 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -1881,8 +1881,8 @@ static void vfio_add_ext_cap(VFIOPCIDevice *vdev) * 0 is reserved for this since absence of capabilities is indicated by * 0 for the ID, version, AND next pointer. However, pcie_add_capability() * uses ID 0 as reserved for list management and will incorrectly match and - * assert if we attempt to pre-load the head of the chain with with this - * ID. Use ID 0xFFFF temporarily since it is also seems to be reserved in + * assert if we attempt to pre-load the head of the chain with this ID. + * Use ID 0xFFFF temporarily since it is also seems to be reserved in * part for identifying absence of capabilities in a root complex register * block. If the ID still exists after adding capabilities, switch back to * zero. We'll mark this entire first dword as emulated for this purpose. -- cgit v1.1 From ba56e4cad41ea2b2fb68d18a632ebc7d4e4b1051 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Mon, 9 Jan 2017 16:45:09 +0000 Subject: hw/display/framebuffer.c: Avoid overflow for framebuffers > 4GB Coverity points out that calculating src_len by multiplying src_width by rows could overflow. This can only happen in the implausible case of a framebuffer larger than 4GB, but we may as well fix it, placating Coverity. (CID1005515) Signed-off-by: Peter Maydell Signed-off-by: Michael Tokarev --- hw/display/framebuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw') diff --git a/hw/display/framebuffer.c b/hw/display/framebuffer.c index df51358..25aa46c 100644 --- a/hw/display/framebuffer.c +++ b/hw/display/framebuffer.c @@ -78,7 +78,7 @@ void framebuffer_update_display( i = *first_row; *first_row = -1; - src_len = src_width * rows; + src_len = (hwaddr)src_width * rows; mem = mem_section->mr; if (!mem) { -- cgit v1.1 From 4f04560ba93f179151d90b0e6c6c53235fe1a279 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Mon, 16 Jan 2017 18:46:00 +0000 Subject: scsi-disk: add 'fall through' comment to switch VERIFY cases Commit 166dbda7e131 added some extra cases to a switch() such that the existing code is intended to fall through the new case statements. It's clear from the commit that this is intentional, but less clear to subsequent readers of the code, and not clear at all to static analysis tools like Coverity. Add a /* fall through */ comment to indicate the intent. (Fixes CID 1368287.) Signed-off-by: Peter Maydell Signed-off-by: Michael Tokarev --- hw/scsi/scsi-disk.c | 1 + 1 file changed, 1 insertion(+) (limited to 'hw') diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index c080888..cc06fe5 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2157,6 +2157,7 @@ static int32_t scsi_disk_dma_command(SCSIRequest *req, uint8_t *buf) DPRINTF("Write %s(sector %" PRId64 ", count %u)\n", (command & 0xe) == 0xe ? "And Verify " : "", r->req.cmd.lba, len); + /* fall through */ case VERIFY_10: case VERIFY_12: case VERIFY_16: -- cgit v1.1 From cdab4dc01a38146543d5c0d0d09433cd4b776936 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Fri, 20 Jan 2017 14:11:04 +0100 Subject: usb: Set category and description of the MTP device It's a storage device, so let's classify it accordingly. And while we're at it, also add a short description for people who do not know what MTP means. Signed-off-by: Thomas Huth Reviewed-by: Laurent Vivier Signed-off-by: Michael Tokarev --- hw/usb/dev-mtp.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'hw') diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 809dcf5..94c2e94 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -1580,6 +1580,8 @@ static void usb_mtp_class_initfn(ObjectClass *klass, void *data) uc->handle_reset = usb_mtp_handle_reset; uc->handle_control = usb_mtp_handle_control; uc->handle_data = usb_mtp_handle_data; + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); + dc->desc = "USB Media Transfer Protocol device"; dc->fw_name = "mtp"; dc->vmsd = &vmstate_usb_mtp; dc->props = mtp_properties; -- cgit v1.1 From 5658ffa39aae034458231bc4abfee57637b88c6e Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Fri, 20 Jan 2017 16:53:59 +0100 Subject: hw/isa/isa-bus: Set category of the "isabus-bridge" device It has "bridge" in its name, so it should be in the category DEVICE_CATEGORY_BRIDGE. Signed-off-by: Thomas Huth Reviewed-by: Markus Armbruster Signed-off-by: Michael Tokarev --- hw/isa/isa-bus.c | 1 + 1 file changed, 1 insertion(+) (limited to 'hw') diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index 9d07b11..0ffbc8d 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -219,6 +219,7 @@ static void isabus_bridge_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); dc->fw_name = "isa"; } -- cgit v1.1