[PATCH v2 13/13] monitor/hmp-cmds: Remove redundant statement in hmp_rocker_of_dpa_groups()

2020-02-26 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: monitor/hmp-cmds.c:2867:17: warning: Value stored to 'set' is never read set = true; ^ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: "Dr. David Alan Gilbert" Cc: Philippe Mathieu-Daudé

[PATCH v2 12/13] usb/hcd-ehci: Remove redundant statements

2020-02-26 Thread kuhn.chenqun
From: Chen Qun The "again" assignment is meaningless before g_assert_not_reached. In addition, the break statements no longer needs to be after g_assert_not_reached. Clang static code analyzer show warning: hw/usb/hcd-ehci.c:2108:13: warning: Value stored to 'again' is never read aga

[PATCH v2 11/13] timer/exynos4210_mct: Remove redundant statement in exynos4210_mct_write()

2020-02-26 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: hw/timer/exynos4210_mct.c:1370:9: warning: Value stored to 'index' is never read index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i); ^ ~ hw/timer/exynos4210_mct.c:1399:9: warning: Value st

[PATCH v2 04/13] scsi/esp-pci: Remove redundant statement in esp_pci_io_write()

2020-02-26 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: hw/scsi/esp-pci.c:198:9: warning: Value stored to 'size' is never read size = 4; ^ ~ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: Paolo Bonzini Cc:Fam Zheng --- hw/scsi/esp-pci.c | 1 - 1 file changed

[PATCH v2 05/13] scsi/scsi-disk: Remove redundant statement in scsi_disk_emulate_command()

2020-02-26 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: scsi/scsi-disk.c:1918:5: warning: Value stored to 'buflen' is never read buflen = req->cmd.xfer; ^~ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: Paolo Bonzini Cc: Fam Zheng --- hw/scsi/scsi-disk.

[PATCH v2 09/13] dma/xlnx-zdma: Remove redundant statement in zdma_write_dst()

2020-02-26 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: hw/dma/xlnx-zdma.c:399:13: warning: Value stored to 'dst_type' is never read dst_type = FIELD_EX32(s->dsc_dst.words[3], ZDMA_CH_DST_DSCR_WORD3, ^ ~~~ Repor

[PATCH v2 06/13] display/pxa2xx_lcd: Remove redundant statement in pxa2xx_palette_parse()

2020-02-26 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: hw/display/pxa2xx_lcd.c:596:9: warning: Value stored to 'format' is never read format = 0; ^~ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: Andrzej Zaborowski Cc: Peter Maydell --- hw/display/pxa2xx_l

[PATCH v2 10/13] migration/vmstate: Remove redundant statement in vmstate_save_state_v()

2020-02-26 Thread kuhn.chenqun
From: Chen Qun The "ret" has been assigned in all branches. It didn't need to be assigned separately. Clang static code analyzer show warning: migration/vmstate.c:365:17: warning: Value stored to 'ret' is never read ret = 0; ^ ~ Reported-by: Euler Robot S

[PATCH v2 08/13] display/blizzard: Remove redundant statement in blizzard_draw_line16_32()

2020-02-26 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: hw/display/blizzard.c:940:9: warning: Value stored to 'data' is never read data >>= 5; ^~ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: Andrzej Zaborowski Cc: Peter Maydell --- hw/display/blizzard.c

[PATCH v2 03/13] block/file-posix: Remove redundant statement in raw_handle_perm_lock()

2020-02-26 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: block/file-posix.c:891:9: warning: Value stored to 'op' is never read op = RAW_PL_ABORT; ^ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: Kevin Wolf Cc: Max Reitz --- block/file-posix.c | 1 -

[PATCH v2 00/13] redundant code: Fix warnings reported by Clang static code analyzer

2020-02-26 Thread kuhn.chenqun
From: Chen Qun Since v1: - Patch1: Addressed John Snow review comment. - Patch12:Addressed Philippe Mathieu-Daudé review comment. - Patch9: Move the 'dst_type' declaration to while() statement. - Patch13: Move the 'set' declaration to the for() statement. Chen Qun (13): block/stream: Remove re

[PATCH v2 07/13] display/exynos4210_fimd: Remove redundant statement in exynos4210_fimd_update()

2020-02-26 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: hw/display/exynos4210_fimd.c:1313:17: warning: Value stored to 'is_dirty' is never read is_dirty = false; Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: Igor Mitsyanko Cc: Peter Maydell --- hw/display/exynos4

[PATCH v2 01/13] block/stream: Remove redundant statement in stream_run()

2020-02-26 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: block/stream.c:186:9: warning: Value stored to 'ret' is never read ret = 0; ^ ~ Reported-by: Euler Robot Signed-off-by: Chen Qun Reviewed-by: John Snow --- Cc: John Snow Cc: Kevin Wolf Cc: Max Reitz --- block/str

[PATCH v2 02/13] block/iscsi:Remove redundant statement in iscsi_open()

2020-02-26 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: block/iscsi.c:1920:9: warning: Value stored to 'flags' is never read flags &= ~BDRV_O_RDWR; ^ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: Ronnie Sahlberg Cc: Paolo Bonzini Cc: Peter Lie

[PATCH 11/13] timer/exynos4210_mct: Remove redundant statement in exynos4210_mct_write()

2020-02-24 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: hw/timer/exynos4210_mct.c:1370:9: warning: Value stored to 'index' is never read index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i); ^ ~ hw/timer/exynos4210_mct.c:1399:9: warning: Value st

[PATCH 02/13] block/iscsi:Remove redundant statement in iscsi_open()

2020-02-24 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: block/iscsi.c:1920:9: warning: Value stored to 'flags' is never read flags &= ~BDRV_O_RDWR; ^ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: Ronnie Sahlberg Cc: Paolo Bonzini Cc: Peter Lie

[PATCH 05/13] scsi/scsi-disk: Remove redundant statement in scsi_disk_emulate_command()

2020-02-24 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: scsi/scsi-disk.c:1918:5: warning: Value stored to 'buflen' is never read buflen = req->cmd.xfer; ^~ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: Paolo Bonzini Cc: Fam Zheng --- hw/scsi/scsi-disk.

[PATCH 01/13] block/stream: Remove redundant statement in stream_run()

2020-02-24 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: block/stream.c:186:9: warning: Value stored to 'ret' is never read ret = 0; ^ ~ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: John Snow Cc: Kevin Wolf Cc: Max Reitz Cc: qemu-bl...@nongnu.org --- block/s

[PATCH 09/13] dma/xlnx-zdma: Remove redundant statement in zdma_write_dst()

2020-02-24 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: hw/dma/xlnx-zdma.c:399:13: warning: Value stored to 'dst_type' is never read dst_type = FIELD_EX32(s->dsc_dst.words[3], ZDMA_CH_DST_DSCR_WORD3, ^ ~~~ Repor

[PATCH 08/13] display/blizzard: Remove redundant statement in blizzard_draw_line16_32()

2020-02-24 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: hw/display/blizzard.c:940:9: warning: Value stored to 'data' is never read data >>= 5; ^~ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: Andrzej Zaborowski Cc: Peter Maydell Cc: qemu-...@nongnu.org ---

[PATCH 13/13] monitor/hmp-cmds: Remove redundant statement in hmp_rocker_of_dpa_groups()

2020-02-24 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: monitor/hmp-cmds.c:2867:17: warning: Value stored to 'set' is never read set = true; ^ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: "Dr. David Alan Gilbert" --- monitor/hmp-cmds.c | 1

[PATCH 06/13] display/pxa2xx_lcd: Remove redundant statement in pxa2xx_palette_parse()

2020-02-24 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: hw/display/pxa2xx_lcd.c:596:9: warning: Value stored to 'format' is never read format = 0; ^~ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: Andrzej Zaborowski Cc: Peter Maydell Cc: qemu-...@nongnu.org

[PATCH 12/13] usb/hcd-ehci: Remove redundant statements

2020-02-24 Thread kuhn.chenqun
From: Chen Qun The "again" assignment is meaningless before g_assert_not_reached. In addition, the break statements no longer needs to be after g_assert_not_reached. Clang static code analyzer show warning: hw/usb/hcd-ehci.c:2108:13: warning: Value stored to 'again' is never read aga

[PATCH 07/13] display/exynos4210_fimd: Remove redundant statement in exynos4210_fimd_update()

2020-02-24 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: hw/display/exynos4210_fimd.c:1313:17: warning: Value stored to 'is_dirty' is never read is_dirty = false; Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: Igor Mitsyanko Cc: Peter Maydell Cc: qemu-...@nongnu.org

[PATCH 10/13] migration/vmstate: Remove redundant statement in vmstate_save_state_v()

2020-02-24 Thread kuhn.chenqun
From: Chen Qun The "ret" has been assigned in all branches. It didn't need to be assigned separately. Clang static code analyzer show warning: migration/vmstate.c:365:17: warning: Value stored to 'ret' is never read ret = 0; ^ ~ Reported-by: Euler Robot S

[PATCH 03/13] block/file-posix: Remove redundant statement in raw_handle_perm_lock()

2020-02-24 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: block/file-posix.c:891:9: warning: Value stored to 'op' is never read op = RAW_PL_ABORT; ^ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: Kevin Wolf Cc: Max Reitz Cc: qemu-bl...@nongnu.org ---

[PATCH 04/13] scsi/esp-pci: Remove redundant statement in esp_pci_io_write()

2020-02-24 Thread kuhn.chenqun
From: Chen Qun Clang static code analyzer show warning: hw/scsi/esp-pci.c:198:9: warning: Value stored to 'size' is never read size = 4; ^ ~ Reported-by: Euler Robot Signed-off-by: Chen Qun --- Cc: Paolo Bonzini Cc: Fam Zheng --- hw/scsi/esp-pci.c | 1 - 1 file change

[PATCH 00/13]redundant code: Fix warnings reported by Clang static code analyzer

2020-02-24 Thread kuhn.chenqun
From: Chen Qun Hi all, our EulerRobot integrates clang static code analyzer tools and found a lot of warnings. They are mainly redundant variable assignments. This series fixes the warnings. Chen Qun (13): block/stream: Remove redundant statement in stream_run() block/iscsi:Remove redundant

[PATCH v2] test-vmstate: Fix memleaks in test_load_qlist

2020-02-20 Thread kuhn.chenqun
From: Chen Qun There is memleak in test_load_qlist().It's not a big deal, but test-vmstate will fail if sanitizers is enabled. In addition, "ret" is written twice with the same value in test_gtree_load_iommu(). Reported-by: Euler Robot Signed-off-by: Chen Qun --- tests/test-vmstate.c | 6 ++

[PATCH 3/3] hw/xtensa/xtfpga:fix leak of fdevice tree blob

2020-02-18 Thread kuhn.chenqun
From: Chen Qun 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 --- hw/xtensa/xtfpga.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.

[PATCH 1/3] hw/nios2:fix leak of fdevice tree blob

2020-02-18 Thread kuhn.chenqun
From: Chen Qun 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 --- hw/nios2/boot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/nios2/boot.c b/hw/nios2/boot.c index 4

[PATCH 2/3] hw/ppc/virtex_ml507:fix leak of fdevice tree blob

2020-02-18 Thread kuhn.chenqun
From: Chen Qun 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 --- hw/ppc/virtex_ml507.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virt

[PATCH 0/3]hw: Fixs memleak of fdevice tree blob

2020-02-18 Thread kuhn.chenqun
From: Chen Qun The device tree blob returned by load_device_tree is malloced. We should free it after cpu_physical_memory_write().Otherwise, if we repeatedly call 'system_reset',it will repeatedly load fdt, so there are many memleaks. Paolo Bonzini : https://lists.gnu.org/archive/html/qemu-devel

[PATCH] test-vmstate: Fix memleaks in test_load_qlist

2020-02-14 Thread kuhn.chenqun
From: Chen Qun We may forget to free fload. ASAN spotted it. Reported-by: Euler Robot Signed-off-by: Chen Qun --- tests/test-vmstate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index cea363dd69..5b2743121b 100644 --- a/tests/test-vmstate.c

[PATCH v2] hw/char/exynos4210_uart: Fix memleaks in exynos4210_uart_init

2020-02-12 Thread kuhn.chenqun
From: Chen Qun It's easy to reproduce as follow: virsh qemu-monitor-command vm1 --pretty '{"execute": "device-list-properties", "arguments":{"typename":"exynos4210.uart"}}' ASAN shows memory leak stack: #1 0xfffd896d71cb in g_malloc0 (/lib64/libglib-2.0.so.0+0x571cb) #2 0xaaad270beee3 in tim

[PATCH] hw/char/exynos4210_uart: Fix memleaks in exynos4210_uart_init

2020-02-11 Thread kuhn.chenqun
From: Chen Qun It's easy to reproduce as follow: virsh qemu-monitor-command vm1 --pretty '{"execute": "device-list-properties", "arguments":{"typename":"exynos4210.uart"}}' ASAN shows memory leak stack: #1 0xfffd896d71cb in g_malloc0 (/lib64/libglib-2.0.so.0+0x571cb) #2 0xaaad270beee3 in tim

[PATCH] contrib/elf2dmp: prevent uninitialized warning

2020-02-06 Thread kuhn.chenqun
From: Chen Qun Fix compilation warnings: contrib/elf2dmp/main.c:66:17: warning: ‘KdpDataBlockEncoded’ may be used uninitialized in this function [-Wmaybe-uninitialized] block = __builtin_bswap64(block ^ kdbe) ^ kwa; ^~~ contrib/elf2dmp/main.c

[PATCH] tests/plugin: prevent uninitialized warning

2020-02-06 Thread kuhn.chenqun
From: Chen Qun According to the glibc function requirements, we need initialise the variable. Otherwise there will be compilation warnings: glib-autocleanups.h:28:3: warning: ‘out’ may be used uninitialized in this function [-Wmaybe-uninitialized] g_free (*pp); ^~~~ Reported-by:

[PATCH] aspeed/i2c:fix uninitialized variable warning

2020-02-05 Thread kuhn.chenqun
From: Chen Qun Fix warning: hw/i2c/aspeed_i2c.c: In function ‘aspeed_i2c_bus_write’: glib/glib-autocleanups.h:28:3: warning: ‘cmd_flags’ may be used uninitialized in this function [-Wmaybe-uninitialized] g_free (*pp); ^~~~ hw/i2c/aspeed_i2c.c:403:22: note: ‘cmd_flags’ was declared h

[PATCH] monitor: fix memory leak in monitor_fdset_dup_fd_find_remove

2020-01-14 Thread kuhn.chenqun
From: Chen Qun When remove dup_fd in monitor_fdset_dup_fd_find_remove function, we need to free mon_fdset_fd_dup. ASAN shows memory leak stack: Direct leak of 96 byte(s) in 3 object(s) allocated from: #0 0xfffd37b033b3 in __interceptor_calloc (/lib64/libasan.so.4+0xd33b3) #1 0xfffd375c71

[PATCH] xhci: Fix memory leak in xhci_kick_epctx when poweroff GuestOS

2020-01-10 Thread kuhn.chenqun
From: Chen Qun start vm with libvirt, when GuestOS running, enter poweroff command using the xhci keyboard, then ASAN shows memory leak stack: Direct leak of 80 byte(s) in 5 object(s) allocated from: #0 0xfffd1e6431cb in __interceptor_malloc (/lib64/libasan.so.4+0xd31cb) #1 0xfffd1e10716

[PATCH] vl: fix memory leak in configure_accelerators

2020-01-08 Thread kuhn.chenqun
From: Chen Qun The accel_list forgot to free, the asan output: Direct leak of 16 byte(s) in 1 object(s) allocated from: #0 0x919331cb in __interceptor_malloc (/lib64/libasan.so.4+0xd31cb) #1 0x913f7163 in g_malloc (/lib64/libglib-2.0.so.0+0x57163) #2 0x91413d9b in g_strsp