All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 00/20] Trivial branch for 5.1 patches
@ 2020-05-04 11:57 Laurent Vivier
  2020-05-04 11:57 ` [PULL 01/20] scsi/esp-pci: add g_assert() for fix clang analyzer warning in esp_pci_io_write() Laurent Vivier
                   ` (20 more replies)
  0 siblings, 21 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev, Laurent Vivier

The following changes since commit 2ef486e76d64436be90f7359a3071fb2a56ce835:

  Merge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into s=
taging (2020-05-03 14:12:56 +0100)

are available in the Git repository at:

  git://github.com/vivier/qemu.git tags/trivial-branch-for-5.1-pull-request

for you to fetch changes up to 4341a0106781043a708c061b676312e5bb5d4488:

  hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning (202=
0-05-04 12:06:21 +0200)

----------------------------------------------------------------
trivial patches (20200504)

Silent static analyzer warning
Remove dead assignments
Support -chardev serial on macOS
Update MAINTAINERS
Some cosmetic changes

----------------------------------------------------------------

Chen Qun (4):
  scsi/esp-pci: add g_assert() for fix clang analyzer warning in
    esp_pci_io_write()
  display/blizzard: use extract16() for fix clang analyzer warning in
    blizzard_draw_line16_32()
  timer/exynos4210_mct: Remove redundant statement in
    exynos4210_mct_write()
  crypto: Redundant type conversion for AES_KEY pointer

Mikhail Gusarov (1):
  chardev: Add macOS to list of OSes that support -chardev serial

Peter Maydell (1):
  elf_ops: Don't try to g_mapped_file_unref(NULL)

Philippe Mathieu-Daud=C3=A9 (11):
  MAINTAINERS: Mark the LatticeMico32 target as orphan
  MAINTAINERS: Update Keith Busch's email address
  block: Avoid dead assignment
  blockdev: Remove dead assignment
  hw/i2c/pm_smbus: Remove dead assignment
  hw/input/adb-kbd: Remove dead assignment
  hw/ide/sii3112: Remove dead assignment
  hw/isa/i82378: Remove dead assignment
  hw/gpio/aspeed_gpio: Remove dead assignment
  hw/timer/stm32f2xx_timer: Remove dead assignment
  hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning

Simran Singhal (1):
  Compress lines for immediate return

Wainer dos Santos Moschetta (2):
  hw/mem/pc-dimm: Print slot number on error at pc_dimm_pre_plug()
  hw/mem/pc-dimm: Fix line over 80 characters warning

 MAINTAINERS                | 14 +++++++-------
 block.c                    |  2 +-
 block/file-posix.c         |  3 +--
 block/nfs.c                |  3 +--
 block/nvme.c               |  4 +---
 block/vhdx.c               |  3 +--
 blockdev.c                 |  2 +-
 chardev/char-serial.c      |  2 +-
 crypto/cipher-builtin.c    |  6 ++----
 hw/audio/ac97.c            |  4 +---
 hw/audio/adlib.c           |  5 +----
 hw/display/blizzard.c      | 10 ++++------
 hw/display/cirrus_vga.c    |  4 +---
 hw/gpio/aspeed_gpio.c      |  2 +-
 hw/i2c/pm_smbus.c          |  1 -
 hw/ide/sii3112.c           |  5 +++--
 hw/input/adb-kbd.c         |  6 +-----
 hw/isa/i82378.c            |  8 ++++----
 hw/mem/pc-dimm.c           |  7 ++++---
 hw/scsi/esp-pci.c          |  1 +
 hw/timer/exynos4210_mct.c  |  4 ----
 hw/timer/pxa2xx_timer.c    |  1 +
 hw/timer/stm32f2xx_timer.c |  1 -
 include/hw/elf_ops.h       |  4 +++-
 include/qemu/osdep.h       |  2 +-
 migration/ram.c            |  4 +---
 ui/gtk.c                   |  3 +--
 util/qemu-sockets.c        |  5 +----
 28 files changed, 45 insertions(+), 71 deletions(-)

--=20
2.26.2



^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PULL 01/20] scsi/esp-pci: add g_assert() for fix clang analyzer warning in esp_pci_io_write()
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 02/20] display/blizzard: use extract16() for fix clang analyzer warning in blizzard_draw_line16_32() Laurent Vivier
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Chen Qun, Michael Tokarev, Laurent Vivier, Euler Robot

From: Chen Qun <kuhn.chenqun@huawei.com>

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 <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200325025919.21316-2-kuhn.chenqun@huawei.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/scsi/esp-pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c
index d5a1f9e01748..497a8d590190 100644
--- a/hw/scsi/esp-pci.c
+++ b/hw/scsi/esp-pci.c
@@ -197,6 +197,7 @@ static void esp_pci_io_write(void *opaque, hwaddr addr,
         addr &= ~3;
         size = 4;
     }
+    g_assert(size >= 4);
 
     if (addr < 0x40) {
         /* SCSI core reg */
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 02/20] display/blizzard: use extract16() for fix clang analyzer warning in blizzard_draw_line16_32()
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
  2020-05-04 11:57 ` [PULL 01/20] scsi/esp-pci: add g_assert() for fix clang analyzer warning in esp_pci_io_write() Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 03/20] timer/exynos4210_mct: Remove redundant statement in exynos4210_mct_write() Laurent Vivier
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Chen Qun, Michael Tokarev, Laurent Vivier, Euler Robot

From: Chen Qun <kuhn.chenqun@huawei.com>

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 <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200325025919.21316-3-kuhn.chenqun@huawei.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/display/blizzard.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/hw/display/blizzard.c b/hw/display/blizzard.c
index 359e399c2a0b..105241577de1 100644
--- a/hw/display/blizzard.c
+++ b/hw/display/blizzard.c
@@ -19,6 +19,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/bitops.h"
 #include "ui/console.h"
 #include "hw/display/blizzard.h"
 #include "ui/pixel_ops.h"
@@ -932,12 +933,9 @@ static void blizzard_draw_line16_32(uint32_t *dest,
     const uint16_t *end = (const void *) src + width;
     while (src < end) {
         data = *src ++;
-        b = (data & 0x1f) << 3;
-        data >>= 5;
-        g = (data & 0x3f) << 2;
-        data >>= 6;
-        r = (data & 0x1f) << 3;
-        data >>= 5;
+        b = extract16(data, 0, 5) << 3;
+        g = extract16(data, 5, 6) << 2;
+        r = extract16(data, 11, 5) << 3;
         *dest++ = rgb_to_pixel32(r, g, b);
     }
 }
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 03/20] timer/exynos4210_mct: Remove redundant statement in exynos4210_mct_write()
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
  2020-05-04 11:57 ` [PULL 01/20] scsi/esp-pci: add g_assert() for fix clang analyzer warning in esp_pci_io_write() Laurent Vivier
  2020-05-04 11:57 ` [PULL 02/20] display/blizzard: use extract16() for fix clang analyzer warning in blizzard_draw_line16_32() Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 04/20] crypto: Redundant type conversion for AES_KEY pointer Laurent Vivier
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Michael Tokarev, Laurent Vivier, Alistair Francis,
	Euler Robot, Chen Qun, Philippe Mathieu-Daudé

From: Chen Qun <kuhn.chenqun@huawei.com>

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 stored to 'index' is never read
        index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i);
        ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/timer/exynos4210_mct.c:1441:9: warning: Value stored to 'index' is never read
        index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i);
        ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200325025919.21316-4-kuhn.chenqun@huawei.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/timer/exynos4210_mct.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
index 944120aea59c..570cf7075bc5 100644
--- a/hw/timer/exynos4210_mct.c
+++ b/hw/timer/exynos4210_mct.c
@@ -1367,7 +1367,6 @@ static void exynos4210_mct_write(void *opaque, hwaddr offset,
 
     case L0_TCNTB: case L1_TCNTB:
         lt_i = GET_L_TIMER_IDX(offset);
-        index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i);
 
         /*
          * TCNTB is updated to internal register only after CNT expired.
@@ -1396,7 +1395,6 @@ static void exynos4210_mct_write(void *opaque, hwaddr offset,
 
     case L0_ICNTB: case L1_ICNTB:
         lt_i = GET_L_TIMER_IDX(offset);
-        index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i);
 
         s->l_timer[lt_i].reg.wstat |= L_WSTAT_ICNTB_WRITE;
         s->l_timer[lt_i].reg.cnt[L_REG_CNT_ICNTB] = value &
@@ -1438,8 +1436,6 @@ static void exynos4210_mct_write(void *opaque, hwaddr offset,
 
     case L0_FRCNTB: case L1_FRCNTB:
         lt_i = GET_L_TIMER_IDX(offset);
-        index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i);
-
         DPRINTF("local timer[%d] FRCNTB write %llx\n", lt_i, value);
 
         s->l_timer[lt_i].reg.wstat |= L_WSTAT_FRCCNTB_WRITE;
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 04/20] crypto: Redundant type conversion for AES_KEY pointer
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (2 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 03/20] timer/exynos4210_mct: Remove redundant statement in exynos4210_mct_write() Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 12:58   ` Daniel P. Berrangé
  2020-05-04 11:57 ` [PULL 05/20] MAINTAINERS: Mark the LatticeMico32 target as orphan Laurent Vivier
                   ` (16 subsequent siblings)
  20 siblings, 1 reply; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Daniel P . Berrangé,
	qemu-trivial, Michael Tokarev, Laurent Vivier, Euler Robot,
	Chen Qun

From: Chen Qun <kuhn.chenqun@huawei.com>

Fix: eaec903c5b8

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Acked-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200325092137.24020-4-kuhn.chenqun@huawei.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 crypto/cipher-builtin.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c
index bf8413e71a6e..99d6280a1669 100644
--- a/crypto/cipher-builtin.c
+++ b/crypto/cipher-builtin.c
@@ -133,8 +133,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx,
 {
     const QCryptoCipherBuiltinAESContext *aesctx = ctx;
 
-    qcrypto_cipher_aes_ecb_encrypt((AES_KEY *)&aesctx->enc,
-                                   src, dst, length);
+    qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc, src, dst, length);
 }
 
 
@@ -145,8 +144,7 @@ static void qcrypto_cipher_aes_xts_decrypt(const void *ctx,
 {
     const QCryptoCipherBuiltinAESContext *aesctx = ctx;
 
-    qcrypto_cipher_aes_ecb_decrypt((AES_KEY *)&aesctx->dec,
-                                   src, dst, length);
+    qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec, src, dst, length);
 }
 
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 05/20] MAINTAINERS: Mark the LatticeMico32 target as orphan
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (3 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 04/20] crypto: Redundant type conversion for AES_KEY pointer Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 06/20] hw/mem/pc-dimm: Print slot number on error at pc_dimm_pre_plug() Laurent Vivier
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Michael Tokarev, Richard Henderson, Laurent Vivier,
	Michael Walle, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Michael Walle expressed his desire to orphan the lm32 target [*]:

  I guess it is time to pull the plug. Mainly, because I have
  no time for this anymore. I've always worked on this on my
  spare time and life changed. And secondly, I guess RISC-V is
  taking over ;) It has a far better ecosystem. Also, to my
  knowledge the only (public) user of LM32 is milkymist and this
  project is dead for years now..

  So time to say goodbye. It was fun and I've learned a lot -
  technically and also how a huge open source project works.
  Thank you everyone for that :)

  Basically everything still works and there are even TCG test
  cases which covers all instructions the processor has.

Many thanks to Michael for his substantial contributions to QEMU,
and for maintaining the LM32 target for various years!

[*] https://www.mail-archive.com/qemu-devel@nongnu.org/msg605024.html

Acked-by: Michael Walle <michael@walle.cc>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200316142827.20867-1-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 MAINTAINERS | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8aa8efaf1d7f..d6886be13159 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -184,8 +184,8 @@ F: hw/net/*i82596*
 F: include/hw/net/lasi_82596.h
 
 LM32 TCG CPUs
-M: Michael Walle <michael@walle.cc>
-S: Maintained
+R: Michael Walle <michael@walle.cc>
+S: Orphan
 F: target/lm32/
 F: disas/lm32.c
 F: hw/lm32/
@@ -977,13 +977,13 @@ F: pc-bios/hppa-firmware.img
 LM32 Machines
 -------------
 EVR32 and uclinux BSP
-M: Michael Walle <michael@walle.cc>
-S: Maintained
+R: Michael Walle <michael@walle.cc>
+S: Orphan
 F: hw/lm32/lm32_boards.c
 
 milkymist
-M: Michael Walle <michael@walle.cc>
-S: Maintained
+R: Michael Walle <michael@walle.cc>
+S: Orphan
 F: hw/lm32/milkymist.c
 
 M68K Machines
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 06/20] hw/mem/pc-dimm: Print slot number on error at pc_dimm_pre_plug()
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (4 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 05/20] MAINTAINERS: Mark the LatticeMico32 target as orphan Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 07/20] hw/mem/pc-dimm: Fix line over 80 characters warning Laurent Vivier
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Michael Tokarev, Laurent Vivier,
	Wainer dos Santos Moschetta

From: Wainer dos Santos Moschetta <wainersm@redhat.com>

The error report in pc_dimm_pre_plug() now has the slot
number printed.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20200310180510.19489-2-wainersm@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/mem/pc-dimm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 8f50b8afea3c..36edfcf46799 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -44,8 +44,8 @@ void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine,
                                    &error_abort);
     if ((slot < 0 || slot >= machine->ram_slots) &&
          slot != PC_DIMM_UNASSIGNED_SLOT) {
-        error_setg(&local_err, "invalid slot number, valid range is [0-%"
-                   PRIu64 "]", machine->ram_slots - 1);
+        error_setg(&local_err, "invalid slot number %d, valid range is [0-%"
+                   PRIu64 "]", slot, machine->ram_slots - 1);
         goto out;
     }
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 07/20] hw/mem/pc-dimm: Fix line over 80 characters warning
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (5 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 06/20] hw/mem/pc-dimm: Print slot number on error at pc_dimm_pre_plug() Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 08/20] elf_ops: Don't try to g_mapped_file_unref(NULL) Laurent Vivier
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Michael Tokarev, Laurent Vivier,
	Wainer dos Santos Moschetta

From: Wainer dos Santos Moschetta <wainersm@redhat.com>

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20200310180510.19489-3-wainersm@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/mem/pc-dimm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 36edfcf46799..6d62588fea8c 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -218,7 +218,8 @@ static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm, Error **errp)
 
 static uint64_t pc_dimm_md_get_addr(const MemoryDeviceState *md)
 {
-    return object_property_get_uint(OBJECT(md), PC_DIMM_ADDR_PROP, &error_abort);
+    return object_property_get_uint(OBJECT(md), PC_DIMM_ADDR_PROP,
+                                    &error_abort);
 }
 
 static void pc_dimm_md_set_addr(MemoryDeviceState *md, uint64_t addr,
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 08/20] elf_ops: Don't try to g_mapped_file_unref(NULL)
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (6 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 07/20] hw/mem/pc-dimm: Fix line over 80 characters warning Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 09/20] MAINTAINERS: Update Keith Busch's email address Laurent Vivier
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-trivial, Michael Tokarev, Laurent Vivier,
	Randy Yates, Philippe Mathieu-Daudé,
	Stefano Garzarella

From: Peter Maydell <peter.maydell@linaro.org>

Calling g_mapped_file_unref() on a NULL pointer is not valid, and
glib will assert if you try it.

$ qemu-system-arm -M virt -display none -device loader,file=/tmp/bad.elf
qemu-system-arm: -device loader,file=/tmp/bad.elf: GLib: g_mapped_file_unref: assertion 'file != NULL' failed

(One way to produce an ELF file that fails like this is to copy just
the first 16 bytes of a valid ELF file; this is sufficient to fool
the code in load_elf_ram_sym() into thinking it's an ELF file and
calling load_elf32() or load_elf64().)

The failure-exit path in load_elf can be reached from various points
in execution, and for some of those we haven't yet called
g_mapped_file_new_from_fd().  Add a condition to the unref call so we
only call it if we successfully created the GMappedFile to start with.

This will fix the assertion; for the specific case of the generic
loader it will then fall back from "guess this is an ELF file" to
"maybe it's a uImage or a hex file" and eventually to "just load as
a raw data file".

Reported-by: Randy Yates <yates@ieee.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20200423202011.32686-1-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 include/hw/elf_ops.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
index e0bb47bb678d..398a4a2c85bb 100644
--- a/include/hw/elf_ops.h
+++ b/include/hw/elf_ops.h
@@ -606,7 +606,9 @@ static int glue(load_elf, SZ)(const char *name, int fd,
         *highaddr = (uint64_t)(elf_sword)high;
     ret = total_size;
  fail:
-    g_mapped_file_unref(mapped_file);
+    if (mapped_file) {
+        g_mapped_file_unref(mapped_file);
+    }
     g_free(phdr);
     return ret;
 }
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 09/20] MAINTAINERS: Update Keith Busch's email address
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (7 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 08/20] elf_ops: Don't try to g_mapped_file_unref(NULL) Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 10/20] chardev: Add macOS to list of OSes that support -chardev serial Laurent Vivier
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Keith Busch, Michael Tokarev, Laurent Vivier,
	Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

keith.busch@intel.com address is being rejected.
Replace by the email address Keith is actively using.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Keith Busch <kbusch@kernel.org>
Message-Id: <20200421122236.24867-1-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index d6886be13159..1f84e3ae2c6a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1735,7 +1735,7 @@ F: hw/virtio/virtio-crypto-pci.c
 F: include/hw/virtio/virtio-crypto.h
 
 nvme
-M: Keith Busch <keith.busch@intel.com>
+M: Keith Busch <kbusch@kernel.org>
 L: qemu-block@nongnu.org
 S: Supported
 F: hw/block/nvme*
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 10/20] chardev: Add macOS to list of OSes that support -chardev serial
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (8 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 09/20] MAINTAINERS: Update Keith Busch's email address Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 11/20] Compress lines for immediate return Laurent Vivier
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Mikhail Gusarov, Michael Tokarev, Laurent Vivier,
	Philippe Mathieu-Daudé

From: Mikhail Gusarov <dottedmag@dottedmag.net>

macOS API for dealing with serial ports/ttys is identical to BSDs.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200426210956.17324-1-dottedmag@dottedmag.net>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 chardev/char-serial.c | 2 +-
 include/qemu/osdep.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/chardev/char-serial.c b/chardev/char-serial.c
index 5b833ea0773b..7c3d84ae243e 100644
--- a/chardev/char-serial.c
+++ b/chardev/char-serial.c
@@ -53,7 +53,7 @@ static void qmp_chardev_open_serial(Chardev *chr,
 
 #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)      \
     || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
-    || defined(__GLIBC__)
+    || defined(__GLIBC__) || defined(__APPLE__)
 
 static void tty_serial_init(int fd, int speed,
                             int parity, int data_bits, int stop_bits)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 20f5c5f197d0..ff7c17b85735 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -379,7 +379,7 @@ void qemu_anon_ram_free(void *ptr, size_t size);
 #define HAVE_CHARDEV_SERIAL 1
 #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)    \
     || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
-    || defined(__GLIBC__)
+    || defined(__GLIBC__) || defined(__APPLE__)
 #define HAVE_CHARDEV_SERIAL 1
 #endif
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 11/20] Compress lines for immediate return
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (9 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 10/20] chardev: Add macOS to list of OSes that support -chardev serial Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 12/20] block: Avoid dead assignment Laurent Vivier
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Simran Singhal, Michael Tokarev, Laurent Vivier,
	Stefan Hajnoczi

From: Simran Singhal <singhalsimran0@gmail.com>

Compress two lines into a single line if immediate return statement is found.

It also remove variables progress, val, data, ret and sock
as they are no longer needed.

Remove space between function "mixer_load" and '(' to fix the
checkpatch.pl error:-
ERROR: space prohibited between function name and open parenthesis '('

Done using following coccinelle script:
@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Simran Singhal <singhalsimran0@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200401165314.GA3213@simran-Inspiron-5558>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 block/file-posix.c      | 3 +--
 block/nfs.c             | 3 +--
 block/nvme.c            | 4 +---
 block/vhdx.c            | 3 +--
 hw/audio/ac97.c         | 4 +---
 hw/audio/adlib.c        | 5 +----
 hw/display/cirrus_vga.c | 4 +---
 migration/ram.c         | 4 +---
 ui/gtk.c                | 3 +--
 util/qemu-sockets.c     | 5 +----
 10 files changed, 10 insertions(+), 28 deletions(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index bf09ad8bc0d0..8fd8c27305cc 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1631,8 +1631,7 @@ static int handle_aiocb_write_zeroes_unmap(void *opaque)
 
     /* If we couldn't manage to unmap while guaranteed that the area reads as
      * all-zero afterwards, just write zeroes without unmapping */
-    ret = handle_aiocb_write_zeroes(aiocb);
-    return ret;
+    return handle_aiocb_write_zeroes(aiocb);
 }
 
 #ifndef HAVE_COPY_FILE_RANGE
diff --git a/block/nfs.c b/block/nfs.c
index 2393fbfe6bcc..18c0a7369454 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -623,8 +623,7 @@ static int nfs_file_open(BlockDriverState *bs, QDict *options, int flags,
     }
 
     bs->total_sectors = ret;
-    ret = 0;
-    return ret;
+    return 0;
 }
 
 static QemuOptsList nfs_create_opts = {
diff --git a/block/nvme.c b/block/nvme.c
index 7b7c0cc5d673..eb2f54dd9dc9 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -575,11 +575,9 @@ static bool nvme_poll_cb(void *opaque)
 {
     EventNotifier *e = opaque;
     BDRVNVMeState *s = container_of(e, BDRVNVMeState, irq_notifier);
-    bool progress = false;
 
     trace_nvme_poll_cb(s);
-    progress = nvme_poll_queues(s);
-    return progress;
+    return nvme_poll_queues(s);
 }
 
 static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
diff --git a/block/vhdx.c b/block/vhdx.c
index 45be0a43218c..aedd78260455 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -411,8 +411,7 @@ int vhdx_update_headers(BlockDriverState *bs, BDRVVHDXState *s,
     if (ret < 0) {
         return ret;
     }
-    ret = vhdx_update_header(bs, s, generate_data_write_guid, log_guid);
-    return ret;
+    return vhdx_update_header(bs, s, generate_data_write_guid, log_guid);
 }
 
 /* opens the specified header block from the VHDX file header section */
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
index 1ec87feec0cb..8a9b9924c495 100644
--- a/hw/audio/ac97.c
+++ b/hw/audio/ac97.c
@@ -573,11 +573,9 @@ static uint32_t nam_readb (void *opaque, uint32_t addr)
 static uint32_t nam_readw (void *opaque, uint32_t addr)
 {
     AC97LinkState *s = opaque;
-    uint32_t val = ~0U;
     uint32_t index = addr;
     s->cas = 0;
-    val = mixer_load (s, index);
-    return val;
+    return mixer_load(s, index);
 }
 
 static uint32_t nam_readl (void *opaque, uint32_t addr)
diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
index d6c1fb0586c6..7c3b67dcfb8c 100644
--- a/hw/audio/adlib.c
+++ b/hw/audio/adlib.c
@@ -120,13 +120,10 @@ static void adlib_write(void *opaque, uint32_t nport, uint32_t val)
 static uint32_t adlib_read(void *opaque, uint32_t nport)
 {
     AdlibState *s = opaque;
-    uint8_t data;
     int a = nport & 3;
 
     adlib_kill_timers (s);
-    data = OPLRead (s->opl, a);
-
-    return data;
+    return OPLRead (s->opl, a);
 }
 
 static void timer_handler (void *opaque, int c, double interval_Sec)
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index 0d391e1300aa..1f29731ffe11 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -2411,12 +2411,10 @@ static uint64_t cirrus_linear_bitblt_read(void *opaque,
                                           unsigned size)
 {
     CirrusVGAState *s = opaque;
-    uint32_t ret;
 
     /* XXX handle bitblt */
     (void)s;
-    ret = 0xff;
-    return ret;
+    return 0xff;
 }
 
 static void cirrus_linear_bitblt_write(void *opaque,
diff --git a/migration/ram.c b/migration/ram.c
index 04f13feb2e77..06cba8863280 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2135,9 +2135,7 @@ int ram_postcopy_send_discard_bitmap(MigrationState *ms)
     }
     trace_ram_postcopy_send_discard_bitmap();
 
-    ret = postcopy_each_ram_send_discard(ms);
-
-    return ret;
+    return postcopy_each_ram_send_discard(ms);
 }
 
 /**
diff --git a/ui/gtk.c b/ui/gtk.c
index 030b251c6109..83f2f5d49b2a 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1650,8 +1650,7 @@ static GSList *gd_vc_menu_init(GtkDisplayState *s, VirtualConsole *vc,
                      G_CALLBACK(gd_menu_switch_vc), s);
     gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), vc->menu_item);
 
-    group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(vc->menu_item));
-    return group;
+    return gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(vc->menu_item));
 }
 
 #if defined(CONFIG_VTE)
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index bcc06d0e01c7..86c48b9fa5de 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -765,15 +765,12 @@ static int vsock_connect_addr(const struct sockaddr_vm *svm, Error **errp)
 static int vsock_connect_saddr(VsockSocketAddress *vaddr, Error **errp)
 {
     struct sockaddr_vm svm;
-    int sock = -1;
 
     if (!vsock_parse_vaddr_to_sockaddr(vaddr, &svm, errp)) {
         return -1;
     }
 
-    sock = vsock_connect_addr(&svm, errp);
-
-    return sock;
+    return vsock_connect_addr(&svm, errp);
 }
 
 static int vsock_listen_saddr(VsockSocketAddress *vaddr,
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 12/20] block: Avoid dead assignment
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (10 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 11/20] Compress lines for immediate return Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 13/20] blockdev: Remove " Laurent Vivier
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Michael Tokarev, Laurent Vivier, Markus Armbruster,
	Alistair Francis, Max Reitz, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Fix warning reported by Clang static code analyzer:

  block.c:3167:5: warning: Value stored to 'ret' is never read
      ret = bdrv_fill_options(&options, filename, &flags, &local_err);
      ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 462f5bcf6
Reported-by: Clang Static Analyzer
Suggested-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200422133152.16770-2-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block.c b/block.c
index 301ec588bda2..cf5c19b1db49 100644
--- a/block.c
+++ b/block.c
@@ -3165,7 +3165,7 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
     }
 
     ret = bdrv_fill_options(&options, filename, &flags, &local_err);
-    if (local_err) {
+    if (ret < 0) {
         goto fail;
     }
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 13/20] blockdev: Remove dead assignment
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (11 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 12/20] block: Avoid dead assignment Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 14/20] hw/i2c/pm_smbus: " Laurent Vivier
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Philippe Mathieu-Daudé,
	Michael Tokarev, Laurent Vivier, Max Reitz

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Fix warning reported by Clang static code analyzer:

    CC      blockdev.o
  blockdev.c:2744:5: warning: Value stored to 'ret' is never read
      ret = blk_truncate(blk, size, false, PREALLOC_MODE_OFF, errp);
      ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reported-by: Clang Static Analyzer
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200422133152.16770-3-philmd@redhat.com>
[lv: fix conflict because of "Add flags to blk_truncate()"]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 blockdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/blockdev.c b/blockdev.c
index dc1a0c7c2fd4..708d0c323fd2 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2741,7 +2741,7 @@ void qmp_block_resize(bool has_device, const char *device,
     }
 
     bdrv_drained_begin(bs);
-    ret = blk_truncate(blk, size, false, PREALLOC_MODE_OFF, 0, errp);
+    blk_truncate(blk, size, false, PREALLOC_MODE_OFF, 0, errp);
     bdrv_drained_end(bs);
 
 out:
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 14/20] hw/i2c/pm_smbus: Remove dead assignment
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (12 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 13/20] blockdev: Remove " Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 15/20] hw/input/adb-kbd: " Laurent Vivier
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Philippe Mathieu-Daudé,
	Alistair Francis, Michael Tokarev, Laurent Vivier

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Fix warning reported by Clang static code analyzer:

    CC      hw/i2c/pm_smbus.o
  hw/i2c/pm_smbus.c:187:17: warning: Value stored to 'ret' is never read
                  ret = 0;
                  ^     ~

Reported-by: Clang Static Analyzer
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200422133152.16770-4-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/i2c/pm_smbus.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c
index 36994ff5857c..4728540c37e6 100644
--- a/hw/i2c/pm_smbus.c
+++ b/hw/i2c/pm_smbus.c
@@ -184,7 +184,6 @@ static void smb_transaction(PMSMBus *s)
                 s->smb_stat |= STS_HOST_BUSY | STS_BYTE_DONE;
                 s->smb_data[0] = s->smb_blkdata;
                 s->smb_index = 0;
-                ret = 0;
             }
             goto out;
         }
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 15/20] hw/input/adb-kbd: Remove dead assignment
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (13 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 14/20] hw/i2c/pm_smbus: " Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 16/20] hw/ide/sii3112: " Laurent Vivier
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Michael Tokarev, Laurent Vivier,
	Philippe Mathieu-Daudé,
	David Gibson

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Since commit 5a1f49718 the 'olen' variable is not really
used. Remove it to fix a warning reported by Clang static
code analyzer:

    CC      hw/input/adb-kbd.o
  hw/input/adb-kbd.c:200:5: warning: Value stored to 'olen' is never read
      olen = 0;
      ^      ~

Fixes: 5a1f49718 (adb: add support for QKeyCode)
Reported-by: Clang Static Analyzer
Suggested-by: BALATON Zoltan <balaton@eik.bme.hu>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200422133152.16770-5-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/input/adb-kbd.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/hw/input/adb-kbd.c b/hw/input/adb-kbd.c
index 0ba82075897f..a6d5c9b7c9ac 100644
--- a/hw/input/adb-kbd.c
+++ b/hw/input/adb-kbd.c
@@ -195,9 +195,7 @@ static int adb_kbd_poll(ADBDevice *d, uint8_t *obuf)
 {
     KBDState *s = ADB_KEYBOARD(d);
     int keycode;
-    int olen;
 
-    olen = 0;
     if (s->count == 0) {
         return 0;
     }
@@ -216,7 +214,6 @@ static int adb_kbd_poll(ADBDevice *d, uint8_t *obuf)
     if (keycode == 0x7f) {
         obuf[0] = 0x7f;
         obuf[1] = 0x7f;
-        olen = 2;
     } else {
         obuf[0] = keycode;
         /* NOTE: the power key key-up is the two byte sequence 0xff 0xff;
@@ -224,10 +221,9 @@ static int adb_kbd_poll(ADBDevice *d, uint8_t *obuf)
          * byte, but choose not to bother.
          */
         obuf[1] = 0xff;
-        olen = 2;
     }
 
-    return olen;
+    return 2;
 }
 
 static int adb_kbd_request(ADBDevice *d, uint8_t *obuf,
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 16/20] hw/ide/sii3112: Remove dead assignment
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (14 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 15/20] hw/input/adb-kbd: " Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 17/20] hw/isa/i82378: " Laurent Vivier
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, John Snow, Michael Tokarev, Laurent Vivier,
	Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Fix warning reported by Clang static code analyzer:

    CC      hw/ide/sii3112.o
  hw/ide/sii3112.c:204:9: warning: Value stored to 'val' is never read
          val = 0;
          ^     ~

Fixes: a9dd6604
Reported-by: Clang Static Analyzer
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Acked-by: John Snow <jsnow@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200422133152.16770-6-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/ide/sii3112.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c
index d69079c3d9b7..94d2b57f9535 100644
--- a/hw/ide/sii3112.c
+++ b/hw/ide/sii3112.c
@@ -42,7 +42,7 @@ static uint64_t sii3112_reg_read(void *opaque, hwaddr addr,
                                 unsigned int size)
 {
     SiI3112PCIState *d = opaque;
-    uint64_t val = 0;
+    uint64_t val;
 
     switch (addr) {
     case 0x00:
@@ -126,6 +126,7 @@ static uint64_t sii3112_reg_read(void *opaque, hwaddr addr,
         break;
     default:
         val = 0;
+        break;
     }
     trace_sii3112_read(size, addr, val);
     return val;
@@ -201,7 +202,7 @@ static void sii3112_reg_write(void *opaque, hwaddr addr,
         d->regs[1].sien = (val >> 16) & 0x3eed;
         break;
     default:
-        val = 0;
+        break;
     }
 }
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 17/20] hw/isa/i82378: Remove dead assignment
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (15 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 16/20] hw/ide/sii3112: " Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 18/20] hw/gpio/aspeed_gpio: " Laurent Vivier
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Philippe Mathieu-Daudé,
	Alistair Francis, Michael Tokarev, Laurent Vivier

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Rename the unique variable assigned as 'pit' which better
represents what it holds, to fix a warning reported by the
Clang static code analyzer:

    CC      hw/isa/i82378.o
  hw/isa/i82378.c:108:5: warning: Value stored to 'isa' is never read
      isa = isa_create_simple(isabus, "i82374");
      ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reported-by: Clang Static Analyzer
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200422133152.16770-7-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/isa/i82378.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index dcb6b479ea0d..d9e6c7fa0096 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -67,7 +67,7 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
     I82378State *s = I82378(dev);
     uint8_t *pci_conf;
     ISABus *isabus;
-    ISADevice *isa;
+    ISADevice *pit;
 
     pci_conf = pci->config;
     pci_set_word(pci_conf + PCI_COMMAND,
@@ -99,13 +99,13 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
     isa_bus_irqs(isabus, s->i8259);
 
     /* 1 82C54 (pit) */
-    isa = i8254_pit_init(isabus, 0x40, 0, NULL);
+    pit = i8254_pit_init(isabus, 0x40, 0, NULL);
 
     /* speaker */
-    pcspk_init(isabus, isa);
+    pcspk_init(isabus, pit);
 
     /* 2 82C37 (dma) */
-    isa = isa_create_simple(isabus, "i82374");
+    isa_create_simple(isabus, "i82374");
 }
 
 static void i82378_init(Object *obj)
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 18/20] hw/gpio/aspeed_gpio: Remove dead assignment
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (16 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 17/20] hw/isa/i82378: " Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 19/20] hw/timer/stm32f2xx_timer: " Laurent Vivier
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Philippe Mathieu-Daudé,
	Michael Tokarev, Laurent Vivier, Cédric Le Goater

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Fix warning reported by Clang static code analyzer:

  hw/gpio/aspeed_gpio.c:717:18: warning: Value stored to 'g_idx' during its initialization is never read
      int set_idx, g_idx = *group_idx;
                   ^~~~~   ~~~~~~~~~~

Reported-by: Clang Static Analyzer
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200422133152.16770-8-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/gpio/aspeed_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c
index e52fcfd9a030..4c75b5c80cc9 100644
--- a/hw/gpio/aspeed_gpio.c
+++ b/hw/gpio/aspeed_gpio.c
@@ -712,7 +712,7 @@ static void aspeed_gpio_write(void *opaque, hwaddr offset, uint64_t data,
 static int get_set_idx(AspeedGPIOState *s, const char *group, int *group_idx)
 {
     AspeedGPIOClass *agc = ASPEED_GPIO_GET_CLASS(s);
-    int set_idx, g_idx = *group_idx;
+    int set_idx, g_idx;
 
     for (set_idx = 0; set_idx < agc->nr_gpio_sets; set_idx++) {
         const GPIOSetProperties *set_props = &agc->props[set_idx];
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 19/20] hw/timer/stm32f2xx_timer: Remove dead assignment
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (17 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 18/20] hw/gpio/aspeed_gpio: " Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 11:57 ` [PULL 20/20] hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning Laurent Vivier
  2020-05-04 12:17 ` [PULL 00/20] Trivial branch for 5.1 patches Peter Maydell
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Philippe Mathieu-Daudé,
	Alistair Francis, Michael Tokarev, Laurent Vivier

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Fix warning reported by Clang static code analyzer:

    CC      hw/timer/stm32f2xx_timer.o
  hw/timer/stm32f2xx_timer.c:225:9: warning: Value stored to 'value' is never read
          value = timer_val;
          ^       ~~~~~~~~~

Reported-by: Clang Static Analyzer
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200422133152.16770-9-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/timer/stm32f2xx_timer.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/timer/stm32f2xx_timer.c b/hw/timer/stm32f2xx_timer.c
index 06ec8a02c250..ba8694dcd349 100644
--- a/hw/timer/stm32f2xx_timer.c
+++ b/hw/timer/stm32f2xx_timer.c
@@ -222,7 +222,6 @@ static void stm32f2xx_timer_write(void *opaque, hwaddr offset,
     case TIM_PSC:
         timer_val = stm32f2xx_ns_to_ticks(s, now) - s->tick_offset;
         s->tim_psc = value & 0xFFFF;
-        value = timer_val;
         break;
     case TIM_CNT:
         timer_val = value;
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PULL 20/20] hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (18 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 19/20] hw/timer/stm32f2xx_timer: " Laurent Vivier
@ 2020-05-04 11:57 ` Laurent Vivier
  2020-05-04 12:17 ` [PULL 00/20] Trivial branch for 5.1 patches Peter Maydell
  20 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 11:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Philippe Mathieu-Daudé,
	Alistair Francis, Michael Tokarev, Laurent Vivier

From: Philippe Mathieu-Daudé <philmd@redhat.com>

pxa2xx_timer_tick4() takes an opaque pointer, then calls
pxa2xx_timer_update4(), so the static analyzer can not
verify that the 'n < 8':

  425 static void pxa2xx_timer_tick4(void *opaque)
  426 {
  427     PXA2xxTimer4 *t = (PXA2xxTimer4 *) opaque;
  428     PXA2xxTimerInfo *i = (PXA2xxTimerInfo *) t->tm.info;
  429
  430     pxa2xx_timer_tick(&t->tm);
  433     if (t->control & (1 << 6))
  434         pxa2xx_timer_update4(i, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), t->tm.num - 4);

  135 static void pxa2xx_timer_update4(void *opaque, uint64_t now_qemu, int n)
  136 {
  137     PXA2xxTimerInfo *s = (PXA2xxTimerInfo *) opaque;
  140     static const int counters[8] = { 0, 0, 0, 0, 4, 4, 6, 6 };
  142
  143     if (s->tm4[n].control & (1 << 7))
  144         counter = n;
  145     else
  146         counter = counters[n];

Add an assert() to give the static analyzer a hint, this fixes a
warning reported by Clang static code analyzer:

    CC      hw/timer/pxa2xx_timer.o
  hw/timer/pxa2xx_timer.c:146:17: warning: Assigned value is garbage or undefined
          counter = counters[n];
                  ^ ~~~~~~~~~~~

Reported-by: Clang Static Analyzer
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200422133152.16770-10-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/timer/pxa2xx_timer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/timer/pxa2xx_timer.c b/hw/timer/pxa2xx_timer.c
index cd172cc1e960..944c16588926 100644
--- a/hw/timer/pxa2xx_timer.c
+++ b/hw/timer/pxa2xx_timer.c
@@ -140,6 +140,7 @@ static void pxa2xx_timer_update4(void *opaque, uint64_t now_qemu, int n)
     static const int counters[8] = { 0, 0, 0, 0, 4, 4, 6, 6 };
     int counter;
 
+    assert(n < ARRAY_SIZE(counters));
     if (s->tm4[n].control & (1 << 7))
         counter = n;
     else
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PULL 00/20] Trivial branch for 5.1 patches
  2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
                   ` (19 preceding siblings ...)
  2020-05-04 11:57 ` [PULL 20/20] hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning Laurent Vivier
@ 2020-05-04 12:17 ` Peter Maydell
  2020-05-04 12:32   ` Laurent Vivier
                     ` (2 more replies)
  20 siblings, 3 replies; 28+ messages in thread
From: Peter Maydell @ 2020-05-04 12:17 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: QEMU Trivial, Michael Tokarev, QEMU Developers

On Mon, 4 May 2020 at 13:05, Laurent Vivier <laurent@vivier.eu> wrote:
>
> The following changes since commit 2ef486e76d64436be90f7359a3071fb2a56ce835:
>
>   Merge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into s=
> taging (2020-05-03 14:12:56 +0100)
>
> are available in the Git repository at:
>
>   git://github.com/vivier/qemu.git tags/trivial-branch-for-5.1-pull-request
>
> for you to fetch changes up to 4341a0106781043a708c061b676312e5bb5d4488:
>
>   hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning (202=
> 0-05-04 12:06:21 +0200)
>
> ----------------------------------------------------------------
> trivial patches (20200504)
>
> Silent static analyzer warning
> Remove dead assignments
> Support -chardev serial on macOS
> Update MAINTAINERS
> Some cosmetic changes


Compile failure, OSX:
/Users/pm215/src/qemu-for-merges/block/file-posix.c:1620:9: error:
unused variable 'ret' [-Werror,-Wunused-variable]
    int ret;
        ^

Compile failure, aarch32 (but probably the result of whatever
crypto options/dependent libraries are on that setup):

In file included from /home/peter.maydell/qemu/crypto/cipher.c:157:0:
/home/peter.maydell/qemu/crypto/cipher-builtin.c: In function
'qcrypto_cipher_aes_xts_encrypt':
/home/peter.maydell/qemu/crypto/cipher-builtin.c:136:36: error:
passing argument 1 of 'qcrypto_cipher_aes_ecb_encrypt' discards
'const' qualifier from pointer target type
[-Werror=discarded-qualifiers]
     qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc, src, dst, length);
                                    ^
/home/peter.maydell/qemu/crypto/cipher-builtin.c:77:13: note: expected
'AES_KEY * {aka struct aes_key_st *}' but argument is of type 'const
AES_KEY * {aka const struct aes_key_st *}'
 static void qcrypto_cipher_aes_ecb_encrypt(AES_KEY *key,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/peter.maydell/qemu/crypto/cipher-builtin.c: In function
'qcrypto_cipher_aes_xts_decrypt':
/home/peter.maydell/qemu/crypto/cipher-builtin.c:147:36: error:
passing argument 1 of 'qcrypto_cipher_aes_ecb_decrypt' discards
'const' qualifier from pointer target type
[-Werror=discarded-qualifiers]
     qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec, src, dst, length);
                                    ^
/home/peter.maydell/qemu/crypto/cipher-builtin.c:103:13: note:
expected 'AES_KEY * {aka struct aes_key_st *}' but argument is of type
'const AES_KEY * {aka const struct aes_key_st *}'
 static void qcrypto_cipher_aes_ecb_decrypt(AES_KEY *key,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

thanks
-- PMM


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PULL 00/20] Trivial branch for 5.1 patches
  2020-05-04 12:17 ` [PULL 00/20] Trivial branch for 5.1 patches Peter Maydell
@ 2020-05-04 12:32   ` Laurent Vivier
  2020-05-04 12:34   ` Daniel P. Berrangé
  2020-05-04 12:34   ` Peter Maydell
  2 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 12:32 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Trivial, Michael Tokarev, QEMU Developers

Le 04/05/2020 à 14:17, Peter Maydell a écrit :
> On Mon, 4 May 2020 at 13:05, Laurent Vivier <laurent@vivier.eu> wrote:
>>
>> The following changes since commit 2ef486e76d64436be90f7359a3071fb2a56ce835:
>>
>>   Merge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into s=
>> taging (2020-05-03 14:12:56 +0100)
>>
>> are available in the Git repository at:
>>
>>   git://github.com/vivier/qemu.git tags/trivial-branch-for-5.1-pull-request
>>
>> for you to fetch changes up to 4341a0106781043a708c061b676312e5bb5d4488:
>>
>>   hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning (202=
>> 0-05-04 12:06:21 +0200)
>>
>> ----------------------------------------------------------------
>> trivial patches (20200504)
>>
>> Silent static analyzer warning
>> Remove dead assignments
>> Support -chardev serial on macOS
>> Update MAINTAINERS
>> Some cosmetic changes
> 
> 
> Compile failure, OSX:
> /Users/pm215/src/qemu-for-merges/block/file-posix.c:1620:9: error:
> unused variable 'ret' [-Werror,-Wunused-variable]
>     int ret;
>         ^
> 
> Compile failure, aarch32 (but probably the result of whatever
> crypto options/dependent libraries are on that setup):
> 
> In file included from /home/peter.maydell/qemu/crypto/cipher.c:157:0:
> /home/peter.maydell/qemu/crypto/cipher-builtin.c: In function
> 'qcrypto_cipher_aes_xts_encrypt':
> /home/peter.maydell/qemu/crypto/cipher-builtin.c:136:36: error:
> passing argument 1 of 'qcrypto_cipher_aes_ecb_encrypt' discards
> 'const' qualifier from pointer target type
> [-Werror=discarded-qualifiers]
>      qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc, src, dst, length);
>                                     ^
> /home/peter.maydell/qemu/crypto/cipher-builtin.c:77:13: note: expected
> 'AES_KEY * {aka struct aes_key_st *}' but argument is of type 'const
> AES_KEY * {aka const struct aes_key_st *}'
>  static void qcrypto_cipher_aes_ecb_encrypt(AES_KEY *key,
>              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/peter.maydell/qemu/crypto/cipher-builtin.c: In function
> 'qcrypto_cipher_aes_xts_decrypt':
> /home/peter.maydell/qemu/crypto/cipher-builtin.c:147:36: error:
> passing argument 1 of 'qcrypto_cipher_aes_ecb_decrypt' discards
> 'const' qualifier from pointer target type
> [-Werror=discarded-qualifiers]
>      qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec, src, dst, length);
>                                     ^
> /home/peter.maydell/qemu/crypto/cipher-builtin.c:103:13: note:
> expected 'AES_KEY * {aka struct aes_key_st *}' but argument is of type
> 'const AES_KEY * {aka const struct aes_key_st *}'
>  static void qcrypto_cipher_aes_ecb_decrypt(AES_KEY *key,
>              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thank you. Next time I will wait end of travis-ci job...

Laurent


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PULL 00/20] Trivial branch for 5.1 patches
  2020-05-04 12:17 ` [PULL 00/20] Trivial branch for 5.1 patches Peter Maydell
  2020-05-04 12:32   ` Laurent Vivier
@ 2020-05-04 12:34   ` Daniel P. Berrangé
  2020-05-04 12:34   ` Peter Maydell
  2 siblings, 0 replies; 28+ messages in thread
From: Daniel P. Berrangé @ 2020-05-04 12:34 UTC (permalink / raw)
  To: Peter Maydell
  Cc: QEMU Trivial, Michael Tokarev, Laurent Vivier, QEMU Developers

On Mon, May 04, 2020 at 01:17:19PM +0100, Peter Maydell wrote:
> On Mon, 4 May 2020 at 13:05, Laurent Vivier <laurent@vivier.eu> wrote:
> >
> > The following changes since commit 2ef486e76d64436be90f7359a3071fb2a56ce835:
> >
> >   Merge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into s=
> > taging (2020-05-03 14:12:56 +0100)
> >
> > are available in the Git repository at:
> >
> >   git://github.com/vivier/qemu.git tags/trivial-branch-for-5.1-pull-request
> >
> > for you to fetch changes up to 4341a0106781043a708c061b676312e5bb5d4488:
> >
> >   hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning (202=
> > 0-05-04 12:06:21 +0200)
> >
> > ----------------------------------------------------------------
> > trivial patches (20200504)
> >
> > Silent static analyzer warning
> > Remove dead assignments
> > Support -chardev serial on macOS
> > Update MAINTAINERS
> > Some cosmetic changes
> 
> 
> Compile failure, OSX:
> /Users/pm215/src/qemu-for-merges/block/file-posix.c:1620:9: error:
> unused variable 'ret' [-Werror,-Wunused-variable]
>     int ret;
>         ^
> 
> Compile failure, aarch32 (but probably the result of whatever
> crypto options/dependent libraries are on that setup):
> 
> In file included from /home/peter.maydell/qemu/crypto/cipher.c:157:0:
> /home/peter.maydell/qemu/crypto/cipher-builtin.c: In function
> 'qcrypto_cipher_aes_xts_encrypt':
> /home/peter.maydell/qemu/crypto/cipher-builtin.c:136:36: error:
> passing argument 1 of 'qcrypto_cipher_aes_ecb_encrypt' discards
> 'const' qualifier from pointer target type
> [-Werror=discarded-qualifiers]
>      qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc, src, dst, length);
>                                     ^
> /home/peter.maydell/qemu/crypto/cipher-builtin.c:77:13: note: expected
> 'AES_KEY * {aka struct aes_key_st *}' but argument is of type 'const
> AES_KEY * {aka const struct aes_key_st *}'
>  static void qcrypto_cipher_aes_ecb_encrypt(AES_KEY *key,
>              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/peter.maydell/qemu/crypto/cipher-builtin.c: In function
> 'qcrypto_cipher_aes_xts_decrypt':
> /home/peter.maydell/qemu/crypto/cipher-builtin.c:147:36: error:
> passing argument 1 of 'qcrypto_cipher_aes_ecb_decrypt' discards
> 'const' qualifier from pointer target type
> [-Werror=discarded-qualifiers]
>      qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec, src, dst, length);
>                                     ^
> /home/peter.maydell/qemu/crypto/cipher-builtin.c:103:13: note:
> expected 'AES_KEY * {aka struct aes_key_st *}' but argument is of type
> 'const AES_KEY * {aka const struct aes_key_st *}'
>  static void qcrypto_cipher_aes_ecb_decrypt(AES_KEY *key,
>              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This failure shows that patch 4 is wrong. The cast is not redundant,
it is explicitly required in order to discard 'const'. Please just
drop patch 4.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PULL 00/20] Trivial branch for 5.1 patches
  2020-05-04 12:17 ` [PULL 00/20] Trivial branch for 5.1 patches Peter Maydell
  2020-05-04 12:32   ` Laurent Vivier
  2020-05-04 12:34   ` Daniel P. Berrangé
@ 2020-05-04 12:34   ` Peter Maydell
  2020-05-04 12:40     ` Laurent Vivier
  2 siblings, 1 reply; 28+ messages in thread
From: Peter Maydell @ 2020-05-04 12:34 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: QEMU Trivial, Michael Tokarev, QEMU Developers

On Mon, 4 May 2020 at 13:17, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Mon, 4 May 2020 at 13:05, Laurent Vivier <laurent@vivier.eu> wrote:
> >
> > The following changes since commit 2ef486e76d64436be90f7359a3071fb2a56ce835:
> >
> >   Merge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into s=
> > taging (2020-05-03 14:12:56 +0100)
> >
> > are available in the Git repository at:
> >
> >   git://github.com/vivier/qemu.git tags/trivial-branch-for-5.1-pull-request
> >
> > for you to fetch changes up to 4341a0106781043a708c061b676312e5bb5d4488:
> >
> >   hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning (202=
> > 0-05-04 12:06:21 +0200)
> >
> > ----------------------------------------------------------------
> > trivial patches (20200504)
> >
> > Silent static analyzer warning
> > Remove dead assignments
> > Support -chardev serial on macOS
> > Update MAINTAINERS
> > Some cosmetic changes
>
>
> Compile failure, OSX:
> /Users/pm215/src/qemu-for-merges/block/file-posix.c:1620:9: error:
> unused variable 'ret' [-Werror,-Wunused-variable]
>     int ret;
>         ^
>

This one also shows up on FreeBSD and OpenBSD (and maybe NetBSD, that
result hasn't come back yet).

thanks
-- PMM


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PULL 00/20] Trivial branch for 5.1 patches
  2020-05-04 12:34   ` Peter Maydell
@ 2020-05-04 12:40     ` Laurent Vivier
  0 siblings, 0 replies; 28+ messages in thread
From: Laurent Vivier @ 2020-05-04 12:40 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Trivial, Michael Tokarev, QEMU Developers

Le 04/05/2020 à 14:34, Peter Maydell a écrit :
> On Mon, 4 May 2020 at 13:17, Peter Maydell <peter.maydell@linaro.org> wrote:
>>
>> On Mon, 4 May 2020 at 13:05, Laurent Vivier <laurent@vivier.eu> wrote:
>>>
>>> The following changes since commit 2ef486e76d64436be90f7359a3071fb2a56ce835:
>>>
>>>   Merge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into s=
>>> taging (2020-05-03 14:12:56 +0100)
>>>
>>> are available in the Git repository at:
>>>
>>>   git://github.com/vivier/qemu.git tags/trivial-branch-for-5.1-pull-request
>>>
>>> for you to fetch changes up to 4341a0106781043a708c061b676312e5bb5d4488:
>>>
>>>   hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning (202=
>>> 0-05-04 12:06:21 +0200)
>>>
>>> ----------------------------------------------------------------
>>> trivial patches (20200504)
>>>
>>> Silent static analyzer warning
>>> Remove dead assignments
>>> Support -chardev serial on macOS
>>> Update MAINTAINERS
>>> Some cosmetic changes
>>
>>
>> Compile failure, OSX:
>> /Users/pm215/src/qemu-for-merges/block/file-posix.c:1620:9: error:
>> unused variable 'ret' [-Werror,-Wunused-variable]
>>     int ret;
>>         ^
>>
> 
> This one also shows up on FreeBSD and OpenBSD (and maybe NetBSD, that
> result hasn't come back yet).

I'm going to update  PATCH 11 to move the "int ret" inside the #ifdef.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PULL 04/20] crypto: Redundant type conversion for AES_KEY pointer
  2020-05-04 11:57 ` [PULL 04/20] crypto: Redundant type conversion for AES_KEY pointer Laurent Vivier
@ 2020-05-04 12:58   ` Daniel P. Berrangé
  2020-05-05  7:20     ` Chenqun (kuhn)
  0 siblings, 1 reply; 28+ messages in thread
From: Daniel P. Berrangé @ 2020-05-04 12:58 UTC (permalink / raw)
  To: Chen Qun
  Cc: qemu-trivial, Euler Robot, Michael Tokarev, qemu-devel, Laurent Vivier

Hi Chen,

This patch triggered a build failure in QEMU about discarding the
"const" qualifier.

IOW, the type conversion is not redundant after all - it is required
in order to explicitly discard "const".

I believe we can probably fix this by changing
qcrypto_cipher_aes_ecb_(en|de)crypt() methods so that they also have
a "const" qualifier on the AES_KEY parameter.

On Mon, May 04, 2020 at 01:57:42PM +0200, Laurent Vivier wrote:
> From: Chen Qun <kuhn.chenqun@huawei.com>
> 
> Fix: eaec903c5b8
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> Acked-by: Daniel P. Berrangé <berrange@redhat.com>
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> Message-Id: <20200325092137.24020-4-kuhn.chenqun@huawei.com>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>  crypto/cipher-builtin.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c
> index bf8413e71a6e..99d6280a1669 100644
> --- a/crypto/cipher-builtin.c
> +++ b/crypto/cipher-builtin.c
> @@ -133,8 +133,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx,
>  {
>      const QCryptoCipherBuiltinAESContext *aesctx = ctx;
>  
> -    qcrypto_cipher_aes_ecb_encrypt((AES_KEY *)&aesctx->enc,
> -                                   src, dst, length);
> +    qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc, src, dst, length);
>  }
>  
>  
> @@ -145,8 +144,7 @@ static void qcrypto_cipher_aes_xts_decrypt(const void *ctx,
>  {
>      const QCryptoCipherBuiltinAESContext *aesctx = ctx;
>  
> -    qcrypto_cipher_aes_ecb_decrypt((AES_KEY *)&aesctx->dec,
> -                                   src, dst, length);
> +    qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec, src, dst, length);
>  }
>  
>  
> -- 
> 2.26.2
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: [PULL 04/20] crypto: Redundant type conversion for AES_KEY pointer
  2020-05-04 12:58   ` Daniel P. Berrangé
@ 2020-05-05  7:20     ` Chenqun (kuhn)
  0 siblings, 0 replies; 28+ messages in thread
From: Chenqun (kuhn) @ 2020-05-05  7:20 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: qemu-trivial, Euler Robot, Michael Tokarev, qemu-devel, Laurent Vivier

>-----Original Message-----
>From: Daniel P. Berrangé [mailto:berrange@redhat.com]
>Sent: Monday, May 4, 2020 8:58 PM
>To: Chenqun (kuhn) <kuhn.chenqun@huawei.com>
>Cc: qemu-devel@nongnu.org; Michael Tokarev <mjt@tls.msk.ru>; qemu-
>trivial@nongnu.org; Laurent Vivier <laurent@vivier.eu>; Euler Robot
><euler.robot@huawei.com>
>Subject: Re: [PULL 04/20] crypto: Redundant type conversion for AES_KEY
>pointer
>
>Hi Chen,
>
>This patch triggered a build failure in QEMU about discarding the "const"
>qualifier.
>
>IOW, the type conversion is not redundant after all - it is required in order to
>explicitly discard "const".
>
Yes, you are right!  Thank you for pointing it out !
It is my carelessness, this patch is not complete. 

>I believe we can probably fix this by changing
>qcrypto_cipher_aes_ecb_(en|de)crypt() methods so that they also have a "const"
>qualifier on the AES_KEY parameter.
>
It's a good point.  I will update the patch later.

Thanks.

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2020-05-05  7:22 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
2020-05-04 11:57 ` [PULL 01/20] scsi/esp-pci: add g_assert() for fix clang analyzer warning in esp_pci_io_write() Laurent Vivier
2020-05-04 11:57 ` [PULL 02/20] display/blizzard: use extract16() for fix clang analyzer warning in blizzard_draw_line16_32() Laurent Vivier
2020-05-04 11:57 ` [PULL 03/20] timer/exynos4210_mct: Remove redundant statement in exynos4210_mct_write() Laurent Vivier
2020-05-04 11:57 ` [PULL 04/20] crypto: Redundant type conversion for AES_KEY pointer Laurent Vivier
2020-05-04 12:58   ` Daniel P. Berrangé
2020-05-05  7:20     ` Chenqun (kuhn)
2020-05-04 11:57 ` [PULL 05/20] MAINTAINERS: Mark the LatticeMico32 target as orphan Laurent Vivier
2020-05-04 11:57 ` [PULL 06/20] hw/mem/pc-dimm: Print slot number on error at pc_dimm_pre_plug() Laurent Vivier
2020-05-04 11:57 ` [PULL 07/20] hw/mem/pc-dimm: Fix line over 80 characters warning Laurent Vivier
2020-05-04 11:57 ` [PULL 08/20] elf_ops: Don't try to g_mapped_file_unref(NULL) Laurent Vivier
2020-05-04 11:57 ` [PULL 09/20] MAINTAINERS: Update Keith Busch's email address Laurent Vivier
2020-05-04 11:57 ` [PULL 10/20] chardev: Add macOS to list of OSes that support -chardev serial Laurent Vivier
2020-05-04 11:57 ` [PULL 11/20] Compress lines for immediate return Laurent Vivier
2020-05-04 11:57 ` [PULL 12/20] block: Avoid dead assignment Laurent Vivier
2020-05-04 11:57 ` [PULL 13/20] blockdev: Remove " Laurent Vivier
2020-05-04 11:57 ` [PULL 14/20] hw/i2c/pm_smbus: " Laurent Vivier
2020-05-04 11:57 ` [PULL 15/20] hw/input/adb-kbd: " Laurent Vivier
2020-05-04 11:57 ` [PULL 16/20] hw/ide/sii3112: " Laurent Vivier
2020-05-04 11:57 ` [PULL 17/20] hw/isa/i82378: " Laurent Vivier
2020-05-04 11:57 ` [PULL 18/20] hw/gpio/aspeed_gpio: " Laurent Vivier
2020-05-04 11:57 ` [PULL 19/20] hw/timer/stm32f2xx_timer: " Laurent Vivier
2020-05-04 11:57 ` [PULL 20/20] hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning Laurent Vivier
2020-05-04 12:17 ` [PULL 00/20] Trivial branch for 5.1 patches Peter Maydell
2020-05-04 12:32   ` Laurent Vivier
2020-05-04 12:34   ` Daniel P. Berrangé
2020-05-04 12:34   ` Peter Maydell
2020-05-04 12:40     ` Laurent Vivier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.