From 4065bb25e95f7059b250ed8194a46bced9a7602b Mon Sep 17 00:00:00 2001 From: Yu-Chen Lin Date: Thu, 6 Feb 2020 20:55:04 +0800 Subject: [PATCH 01/17] mailmap: Add entry for Yu-Chen Lin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I have two mail address, add entries for showing author and email correctly. Signed-off-by: Yu-Chen Lin Reviewed-by: Philippe Mathieu-Daudé Acked-by: Yu-Chen Lin Message-Id: <20200206125504.7150-1-npes87184@gmail.com> Signed-off-by: Laurent Vivier --- .mailmap | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index a521c17b44..76154c7d8a 100644 --- a/.mailmap +++ b/.mailmap @@ -152,7 +152,8 @@ Xiaoqiang Zhao Xinhua Cao Xiong Zhang Yin Yin -yuchenlin +Yu-Chen Lin +Yu-Chen Lin YunQiang Su YunQiang Su Yuri Pudgorodskiy From b09d51c9098adec9c83cc0d8332d03e052844a9f Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Fri, 14 Feb 2020 10:55:19 +0100 Subject: [PATCH 02/17] Report stringified errno in VFIO related errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In a few places we report errno formatted as a negative integer. This is not as user friendly as it can be. Use strerror() and/or error_setg_errno() instead. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko Reviewed-by: Cornelia Huck Reviewed-by: Eric Auger Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Williamson Message-Id: <4949c3ecf1a32189b8a4b5eb4b0fd04c1122501d.1581674006.git.mprivozn@redhat.com> Signed-off-by: Laurent Vivier --- hw/vfio/common.c | 4 ++-- util/vfio-helpers.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 5ca11488d6..0b3593b3c0 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -319,7 +319,7 @@ static int vfio_dma_unmap(VFIOContainer *container, unmap.size -= 1ULL << ctz64(container->pgsizes); continue; } - error_report("VFIO_UNMAP_DMA: %d", -errno); + error_report("VFIO_UNMAP_DMA failed: %s", strerror(errno)); return -errno; } @@ -352,7 +352,7 @@ static int vfio_dma_map(VFIOContainer *container, hwaddr iova, return 0; } - error_report("VFIO_MAP_DMA: %d", -errno); + error_report("VFIO_MAP_DMA failed: %s", strerror(errno)); return -errno; } diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c index 813f7ec564..ddd9a96e76 100644 --- a/util/vfio-helpers.c +++ b/util/vfio-helpers.c @@ -545,7 +545,7 @@ static int qemu_vfio_do_mapping(QEMUVFIOState *s, void *host, size_t size, trace_qemu_vfio_do_mapping(s, host, size, iova); if (ioctl(s->container, VFIO_IOMMU_MAP_DMA, &dma_map)) { - error_report("VFIO_MAP_DMA: %d", -errno); + error_report("VFIO_MAP_DMA failed: %s", strerror(errno)); return -errno; } return 0; @@ -570,7 +570,7 @@ static void qemu_vfio_undo_mapping(QEMUVFIOState *s, IOVAMapping *mapping, assert(QEMU_IS_ALIGNED(mapping->size, qemu_real_host_page_size)); assert(index >= 0 && index < s->nr_mappings); if (ioctl(s->container, VFIO_IOMMU_UNMAP_DMA, &unmap)) { - error_setg(errp, "VFIO_UNMAP_DMA failed: %d", -errno); + error_setg_errno(errp, errno, "VFIO_UNMAP_DMA failed"); } memmove(mapping, &s->mappings[index + 1], sizeof(s->mappings[0]) * (s->nr_mappings - index - 1)); @@ -669,7 +669,7 @@ int qemu_vfio_dma_reset_temporary(QEMUVFIOState *s) trace_qemu_vfio_dma_reset_temporary(s); qemu_mutex_lock(&s->lock); if (ioctl(s->container, VFIO_IOMMU_UNMAP_DMA, &unmap)) { - error_report("VFIO_UNMAP_DMA: %d", -errno); + error_report("VFIO_UNMAP_DMA failed: %s", strerror(errno)); qemu_mutex_unlock(&s->lock); return -errno; } From ee0f3c09e01699d34ba090a80c321d39c58a0556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 18 Feb 2020 10:43:50 +0100 Subject: [PATCH 03/17] scripts/checkpatch.pl: Detect superfluous semicolon in C code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Display error when a commit contains superfluous semicolon: $ git show 6663a0a3376 | scripts/checkpatch.pl -q - ERROR: superfluous trailing semicolon #276: FILE: block/io_uring.c:186: + ret = -ENOSPC;; total: 1 errors, 1 warnings, 485 lines checked Reported-by: Luc Michel Signed-off-by: Philippe Mathieu-Daudé Acked-by: Paolo Bonzini Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Reviewed-by: Luc Michel Message-Id: <20200218094402.26625-2-philmd@redhat.com> Signed-off-by: Laurent Vivier --- scripts/checkpatch.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index ce43a306f8..11512a8a09 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1830,6 +1830,11 @@ sub process { ERROR("suspicious ; after while (0)\n" . $herecurr); } +# Check superfluous trailing ';' + if ($line =~ /;;$/) { + ERROR("superfluous trailing semicolon\n" . $herecurr); + } + # Check relative indent for conditionals and blocks. if ($line =~ /\b(?:(?:if|while|for)\s*\(|do\b)/ && $line !~ /^.\s*#/ && $line !~ /\}\s*while\s*/) { my ($s, $c) = ($stat, $cond); From 3a1bdd15836434d14adc50caff2807513930987f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 18 Feb 2020 10:43:51 +0100 Subject: [PATCH 04/17] audio/alsaaudio: Remove superfluous semicolons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 286a5d201e4 Signed-off-by: Philippe Mathieu-Daudé Acked-by: Paolo Bonzini Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Message-Id: <20200218094402.26625-3-philmd@redhat.com> Signed-off-by: Laurent Vivier --- audio/alsaaudio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index a23a5a0b60..a8e62542f9 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -819,7 +819,7 @@ static size_t alsa_read(HWVoiceIn *hw, void *buf, size_t len) switch (nread) { case 0: trace_alsa_read_zero(len); - return pos;; + return pos; case -EPIPE: if (alsa_recover(alsa->handle)) { @@ -835,7 +835,7 @@ static size_t alsa_read(HWVoiceIn *hw, void *buf, size_t len) default: alsa_logerr(nread, "Failed to read %zu frames to %p\n", len, dst); - return pos;; + return pos; } } From 6ab64e27c526bd519042fbb8e9b5c6efb96804d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 18 Feb 2020 10:43:54 +0100 Subject: [PATCH 05/17] hw/arm/xlnx-versal: Remove superfluous semicolon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 6f16da53ffe Signed-off-by: Philippe Mathieu-Daudé Acked-by: Paolo Bonzini Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Message-Id: <20200218094402.26625-6-philmd@redhat.com> Signed-off-by: Laurent Vivier --- hw/arm/xlnx-versal-virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 462493c467..0d2e3bdda1 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -350,7 +350,7 @@ static void create_virtio_regions(VersalVirt *s) int i; for (i = 0; i < NUM_VIRTIO_TRANSPORT; i++) { - char *name = g_strdup_printf("virtio%d", i);; + char *name = g_strdup_printf("virtio%d", i); hwaddr base = MM_TOP_RSVD + i * virtio_mmio_size; int irq = VERSAL_RSVD_IRQ_FIRST + i; MemoryRegion *mr; From 5012a8941d93d3a43adb12a16c8e954b2837deb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 18 Feb 2020 10:43:55 +0100 Subject: [PATCH 06/17] hw/m68k/next-cube: Remove superfluous semicolon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 956a78118bf Signed-off-by: Philippe Mathieu-Daudé Acked-by: Paolo Bonzini Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Message-Id: <20200218094402.26625-7-philmd@redhat.com> Signed-off-by: Laurent Vivier --- hw/m68k/next-cube.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index e5343348d0..350c6fec78 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -734,7 +734,7 @@ void next_irq(void *opaque, int number, int level) switch (number) { /* level 3 - floppy, kbd/mouse, power, ether rx/tx, scsi, clock */ case NEXT_FD_I: - shift = 7;; + shift = 7; break; case NEXT_KBD_I: shift = 3; From c62c1fa0e38ca8d2f7b6a91689a3f70721366299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 18 Feb 2020 10:43:56 +0100 Subject: [PATCH 07/17] hw/scsi/esp: Remove superfluous semicolon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 74d71ea16bc Signed-off-by: Philippe Mathieu-Daudé Acked-by: Paolo Bonzini Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Message-Id: <20200218094402.26625-8-philmd@redhat.com> Signed-off-by: Laurent Vivier --- hw/scsi/esp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index f8fc30cccb..405f8b7cbc 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -293,7 +293,7 @@ static void handle_satn_stop(ESPState *s) s->dma_cb = handle_satn_stop; return; } - s->pdma_cb = satn_stop_pdma_cb;; + s->pdma_cb = satn_stop_pdma_cb; s->cmdlen = get_cmd(s, s->cmdbuf, sizeof(s->cmdbuf)); if (s->cmdlen) { trace_esp_handle_satn_stop(s->cmdlen); From 180f3fd2d746387d32e53f1a5c75013818dfa86d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 18 Feb 2020 10:43:57 +0100 Subject: [PATCH 08/17] hw/vfio/display: Remove superfluous semicolon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 8b818e059bf Signed-off-by: Philippe Mathieu-Daudé Acked-by: Paolo Bonzini Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Message-Id: <20200218094402.26625-9-philmd@redhat.com> Signed-off-by: Laurent Vivier --- hw/vfio/display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/vfio/display.c b/hw/vfio/display.c index a5a608c5b2..f4977c66e1 100644 --- a/hw/vfio/display.c +++ b/hw/vfio/display.c @@ -287,7 +287,7 @@ static void vfio_display_dmabuf_update(void *opaque) VFIOPCIDevice *vdev = opaque; VFIODisplay *dpy = vdev->dpy; VFIODMABuf *primary, *cursor; - bool free_bufs = false, new_cursor = false;; + bool free_bufs = false, new_cursor = false; primary = vfio_display_get_dmabuf(vdev, DRM_PLANE_TYPE_PRIMARY); if (primary == NULL) { From 29453426121299500337a27d37e5344a88e9c49d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 18 Feb 2020 10:43:59 +0100 Subject: [PATCH 09/17] ui/input-barrier: Remove superfluous semicolon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 6105683da35 Signed-off-by: Philippe Mathieu-Daudé Acked-by: Paolo Bonzini Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Message-Id: <20200218094402.26625-11-philmd@redhat.com> Signed-off-by: Laurent Vivier --- ui/input-barrier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/input-barrier.c b/ui/input-barrier.c index fe35049b83..527c75e130 100644 --- a/ui/input-barrier.c +++ b/ui/input-barrier.c @@ -455,7 +455,7 @@ static gboolean writecmd(InputBarrier *ib, struct barrierMsg *msg) break; default: write_cmd(p, barrierCmdEUnknown, avail); - break;; + break; } len = MAX_HELLO_LENGTH - avail - sizeof(int); From 7c98f0f8c327d1de7f18cafba12755c16d8eeea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 18 Feb 2020 10:44:00 +0100 Subject: [PATCH 10/17] target/i386/whpx: Remove superfluous semicolon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 812d49f2a3e Signed-off-by: Philippe Mathieu-Daudé Acked-by: Paolo Bonzini Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Message-Id: <20200218094402.26625-12-philmd@redhat.com> Signed-off-by: Laurent Vivier --- target/i386/whpx-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index 3ed2aa1892..35601b8176 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -511,7 +511,7 @@ static void whpx_get_registers(CPUState *cpu) /* WHvX64RegisterPat - Skipped */ assert(whpx_register_names[idx] == WHvX64RegisterSysenterCs); - env->sysenter_cs = vcxt.values[idx++].Reg64;; + env->sysenter_cs = vcxt.values[idx++].Reg64; assert(whpx_register_names[idx] == WHvX64RegisterSysenterEip); env->sysenter_eip = vcxt.values[idx++].Reg64; assert(whpx_register_names[idx] == WHvX64RegisterSysenterEsp); From 58bcdda915a60978be3d9856c6120c3573c8f588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 18 Feb 2020 10:44:01 +0100 Subject: [PATCH 11/17] tests/qtest/libqos/qgraph: Remove superfluous semicolons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: fc281c80202 Signed-off-by: Philippe Mathieu-Daudé Acked-by: Paolo Bonzini Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Message-Id: <20200218094402.26625-13-philmd@redhat.com> Signed-off-by: Laurent Vivier --- tests/qtest/libqos/qgraph.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/libqos/qgraph.c b/tests/qtest/libqos/qgraph.c index 7a7ae2a19e..ca01de0743 100644 --- a/tests/qtest/libqos/qgraph.c +++ b/tests/qtest/libqos/qgraph.c @@ -474,7 +474,7 @@ QOSEdgeType qos_graph_edge_get_type(QOSGraphEdge *edge) if (!edge) { return -1; } - return edge->type;; + return edge->type; } char *qos_graph_edge_get_dest(QOSGraphEdge *edge) @@ -590,7 +590,7 @@ void qos_add_test(const char *name, const char *interface, QOSTestFunc test_func, QOSGraphTestOptions *opts) { QOSGraphNode *node; - char *test_name = g_strdup_printf("%s-tests/%s", interface, name);; + char *test_name = g_strdup_printf("%s-tests/%s", interface, name); QOSGraphTestOptions def_opts = { }; if (!opts) { From 1e1f6ab0eb8703589590f340c0c429298cf17905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 18 Feb 2020 10:44:02 +0100 Subject: [PATCH 12/17] contrib/rdmacm-mux: Remove superfluous semicolon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: a5d2f6f8773 Signed-off-by: Philippe Mathieu-Daudé Acked-by: Paolo Bonzini Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Message-Id: <20200218094402.26625-14-philmd@redhat.com> Signed-off-by: Laurent Vivier --- contrib/rdmacm-mux/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/rdmacm-mux/main.c b/contrib/rdmacm-mux/main.c index de53048f06..bd82abbad3 100644 --- a/contrib/rdmacm-mux/main.c +++ b/contrib/rdmacm-mux/main.c @@ -490,7 +490,7 @@ static int read_and_process(int fd) static int accept_all(void) { - int fd, rc = 0;; + int fd, rc = 0; pthread_rwlock_wrlock(&server.lock); From 380e6d811952d39ec51adda9756a07528eac96bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Sat, 15 Feb 2020 17:15:56 +0100 Subject: [PATCH 13/17] hw/display/qxl: Remove unneeded variable assignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix warning reported by Clang static code analyzer: hw/display/qxl.c:1634:14: warning: Value stored to 'orig_io_port' during its initialization is never read uint32_t orig_io_port = io_port; ^~~~~~~~~~~~ ~~~~~~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200215161557.4077-3-philmd@redhat.com> Signed-off-by: Laurent Vivier --- hw/display/qxl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/qxl.c b/hw/display/qxl.c index 64884da708..21a43a1d5e 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -1631,7 +1631,7 @@ static void ioport_write(void *opaque, hwaddr addr, PCIQXLDevice *d = opaque; uint32_t io_port = addr; qxl_async_io async = QXL_SYNC; - uint32_t orig_io_port = io_port; + uint32_t orig_io_port; if (d->guest_bug && io_port != QXL_IO_RESET) { return; From 400be27f82395ca314ec3731c1a4e86843e4f53f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Sat, 15 Feb 2020 17:15:57 +0100 Subject: [PATCH 14/17] hw/block/pflash_cfi02: Remove unneeded variable assignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix warning reported by Clang static code analyzer: CC hw/block/pflash_cfi02.o hw/block/pflash_cfi02.c:311:5: warning: Value stored to 'ret' is never read ret = -1; ^ ~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200215161557.4077-4-philmd@redhat.com> Signed-off-by: Laurent Vivier --- hw/block/pflash_cfi02.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index 7c4744c020..12f18d401a 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -308,7 +308,6 @@ static uint64_t pflash_read(void *opaque, hwaddr offset, unsigned int width) hwaddr boff; uint64_t ret; - ret = -1; /* Lazy reset to ROMD mode after a certain amount of read accesses */ if (!pfl->rom_mode && pfl->wcycle == 0 && ++pfl->read_counter > PFLASH_LAZY_ROMD_THRESHOLD) { From b18ee6a217b88699d436c33543e5c64fff64da45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Mon, 17 Feb 2020 11:16:37 +0100 Subject: [PATCH 15/17] hw/net/rocker: Report unimplemented feature with qemu_log_mask(UNIMP) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix warnings reported by Clang static code analyzer: CC hw/net/rocker/rocker.o hw/net/rocker/rocker.c:213:9: warning: Value stored to 'tx_tso_mss' is never read tx_tso_mss = rocker_tlv_get_le16(tlvs[ROCKER_TLV_TX_TSO_MSS]); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ hw/net/rocker/rocker.c:217:9: warning: Value stored to 'tx_tso_hdr_len' is never read tx_tso_hdr_len = rocker_tlv_get_le16(tlvs[ROCKER_TLV_TX_TSO_HDR_LEN]); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ hw/net/rocker/rocker.c:255:9: warning: Value stored to 'tx_l3_csum_off' is never read tx_l3_csum_off += tx_tso_mss = tx_tso_hdr_len = 0; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: dc488f888 Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi Message-Id: <20200217101637.27558-1-philmd@redhat.com> Signed-off-by: Laurent Vivier --- hw/net/rocker/rocker.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c index 81dd3b5f14..15d66f6cbc 100644 --- a/hw/net/rocker/rocker.c +++ b/hw/net/rocker/rocker.c @@ -27,6 +27,7 @@ #include "qemu/iov.h" #include "qemu/module.h" #include "qemu/bitops.h" +#include "qemu/log.h" #include "rocker.h" #include "rocker_hw.h" @@ -207,14 +208,22 @@ static int tx_consume(Rocker *r, DescInfo *info) if (tlvs[ROCKER_TLV_TX_L3_CSUM_OFF]) { tx_l3_csum_off = rocker_tlv_get_le16(tlvs[ROCKER_TLV_TX_L3_CSUM_OFF]); + qemu_log_mask(LOG_UNIMP, "rocker %s: L3 not implemented" + " (cksum off: %u)\n", + __func__, tx_l3_csum_off); } if (tlvs[ROCKER_TLV_TX_TSO_MSS]) { tx_tso_mss = rocker_tlv_get_le16(tlvs[ROCKER_TLV_TX_TSO_MSS]); + qemu_log_mask(LOG_UNIMP, "rocker %s: TSO not implemented (MSS: %u)\n", + __func__, tx_tso_mss); } if (tlvs[ROCKER_TLV_TX_TSO_HDR_LEN]) { tx_tso_hdr_len = rocker_tlv_get_le16(tlvs[ROCKER_TLV_TX_TSO_HDR_LEN]); + qemu_log_mask(LOG_UNIMP, "rocker %s: TSO not implemented" + " (hdr length: %u)\n", + __func__, tx_tso_hdr_len); } rocker_tlv_for_each_nested(tlv_frag, tlvs[ROCKER_TLV_TX_FRAGS], rem) { @@ -249,12 +258,6 @@ static int tx_consume(Rocker *r, DescInfo *info) iovcnt++; } - if (iovcnt) { - /* XXX perform Tx offloads */ - /* XXX silence compiler for now */ - tx_l3_csum_off += tx_tso_mss = tx_tso_hdr_len = 0; - } - err = fp_port_eg(r->fp_port[port], iov, iovcnt); err_too_many_frags: From 757ca9b81a5d96db5194456ea66dc00bcf618323 Mon Sep 17 00:00:00 2001 From: Chen Qun Date: Tue, 18 Feb 2020 17:11:52 +0800 Subject: [PATCH 16/17] hw/nios2:fix leak of fdevice tree blob The device tree blob returned by load_device_tree is malloced. We should free it after cpu_physical_memory_write(). Reported-by: Euler Robot Signed-off-by: Chen Qun Reviewed-by: Laurent Vivier Message-Id: <20200218091154.21696-2-kuhn.chenqun@huawei.com> Signed-off-by: Laurent Vivier --- hw/nios2/boot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/nios2/boot.c b/hw/nios2/boot.c index 46b8349876..88224aa84c 100644 --- a/hw/nios2/boot.c +++ b/hw/nios2/boot.c @@ -109,6 +109,7 @@ static int nios2_load_dtb(struct nios2_boot_info bi, const uint32_t ramsize, } cpu_physical_memory_write(bi.fdt, fdt, fdt_size); + g_free(fdt); return fdt_size; } From d1cb67841ca213802ee789957188ec87e8b7996d Mon Sep 17 00:00:00 2001 From: Chen Qun Date: Tue, 18 Feb 2020 17:11:54 +0800 Subject: [PATCH 17/17] hw/xtensa/xtfpga:fix leak of fdevice tree blob The device tree blob returned by load_device_tree is malloced. We should free it after cpu_physical_memory_write(). Reported-by: Euler Robot Signed-off-by: Chen Qun Acked-by: Max Filippov Reviewed-by: Laurent Vivier Message-Id: <20200218091154.21696-4-kuhn.chenqun@huawei.com> Signed-off-by: Laurent Vivier --- hw/xtensa/xtfpga.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 8e2dd1327a..60ccc74f5f 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -380,6 +380,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine) cur_tagptr = put_tag(cur_tagptr, BP_TAG_FDT, sizeof(dtb_addr), &dtb_addr); cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + fdt_size, 4 * KiB); + g_free(fdt); } #else if (dtb_filename) {