Skip to contentSkip to conversation

Trivial branch for 5.1 patches

GIT PULL Laurent Vivier 4 participants 28 messages May 4, 2020 – May 5, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

[PULL 02/20] display/blizzard: use extract16() for fix clang analyzer warning in blizzard_draw_line16_32()

From: Chen Qun <[email protected]>

Clang static code analyzer show warning:
hw/display/blizzard.c:940:9: warning: Value stored to 'data' is never read

        data >>= 5;
        ^        ~

Message-Id: <[email protected]>

---
 hw/display/blizzard.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
hw/display/blizzard.c +4 -6
index 359e399c2a0b..105241577de1 100644
@@ -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);
     }
 }
Signature · 1 line
2.26.2
#2 lore raw

[PULL 01/20] scsi/esp-pci: add g_assert() for fix clang analyzer warning in esp_pci_io_write()

In reply to Laurent Vivier

From: Chen Qun <[email protected]>

Clang static code analyzer show warning:
hw/scsi/esp-pci.c:198:9: warning: Value stored to 'size' is never read

        size = 4;
        ^      ~

Message-Id: <[email protected]>

---
 hw/scsi/esp-pci.c | 1 +
 1 file changed, 1 insertion(+)
hw/scsi/esp-pci.c +1 -0
index d5a1f9e01748..497a8d590190 100644
@@ -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 */
Signature · 1 line
2.26.2
#3 lore raw

[PULL 09/20] MAINTAINERS: Update Keith Busch's email address

In reply to Laurent Vivier

From: Philippe Mathieu-Daudé <[email protected]>

[email protected] address is being rejected. Replace by the email address Keith is actively using.

Message-Id: <[email protected]>

---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
MAINTAINERS +1 -1
index d6886be13159..1f84e3ae2c6a 100644
@@ -1735,7 +1735,7 @@ F: hw/virtio/virtio-crypto-pci.c
 F: include/hw/virtio/virtio-crypto.h
 
 nvme
-M: Keith Busch <[email protected]>
+M: Keith Busch <[email protected]>
 L: [email protected]
 S: Supported
 F: hw/block/nvme*
Signature · 1 line
2.26.2
#4 lore raw

[PULL 06/20] hw/mem/pc-dimm: Print slot number on error at pc_dimm_pre_plug()

In reply to Laurent Vivier

From: Wainer dos Santos Moschetta <[email protected]>

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

Message-Id: <[email protected]>

---
 hw/mem/pc-dimm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/mem/pc-dimm.c +2 -2
index 8f50b8afea3c..36edfcf46799 100644
@@ -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;
     }
 
Signature · 1 line
2.26.2
#5 lore raw

[PULL 03/20] timer/exynos4210_mct: Remove redundant statement in exynos4210_mct_write()

In reply to Laurent Vivier

From: Chen Qun <[email protected]>

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);
        ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message-Id: <[email protected]>

---
 hw/timer/exynos4210_mct.c | 4 ----
 1 file changed, 4 deletions(-)
hw/timer/exynos4210_mct.c +0 -4
index 944120aea59c..570cf7075bc5 100644
@@ -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;
Signature · 1 line
2.26.2
#6 lore raw

[PULL 13/20] blockdev: Remove dead assignment

In reply to Laurent Vivier

From: Philippe Mathieu-Daudé <[email protected]>

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

Message-Id: <[email protected]>

[lv: fix conflict because of "Add flags to blk_truncate()"]
---
 blockdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
blockdev.c +1 -1
index dc1a0c7c2fd4..708d0c323fd2 100644
@@ -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:
Signature · 1 line
2.26.2
#7 lore raw

[PULL 10/20] chardev: Add macOS to list of OSes that support -chardev serial

In reply to Laurent Vivier

From: Mikhail Gusarov <[email protected]>

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

Message-Id: <[email protected]>

---
 chardev/char-serial.c | 2 +-
 include/qemu/osdep.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
chardev/char-serial.c +1 -1
index 5b833ea0773b..7c3d84ae243e 100644
@@ -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)
include/qemu/osdep.h +1 -1
index 20f5c5f197d0..ff7c17b85735 100644
@@ -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
 
Signature · 1 line
2.26.2
#8 lore raw

[PULL 11/20] Compress lines for immediate return

In reply to Laurent Vivier

From: Simran Singhal <[email protected]>

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;

Message-Id: <20200401165314.GA3213@simran-Inspiron-5558>

---
 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(-)
block/file-posix.c +1 -2
index bf09ad8bc0d0..8fd8c27305cc 100644
@@ -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
block/nfs.c +1 -2
index 2393fbfe6bcc..18c0a7369454 100644
@@ -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 = {
block/nvme.c +1 -3
index 7b7c0cc5d673..eb2f54dd9dc9 100644
@@ -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,
block/vhdx.c +1 -2
index 45be0a43218c..aedd78260455 100644
@@ -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 */
hw/audio/ac97.c +1 -3
index 1ec87feec0cb..8a9b9924c495 100644
@@ -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)
hw/audio/adlib.c +1 -4
index d6c1fb0586c6..7c3b67dcfb8c 100644
@@ -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)
hw/display/cirrus_vga.c +1 -3
index 0d391e1300aa..1f29731ffe11 100644
@@ -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,
migration/ram.c +1 -3
index 04f13feb2e77..06cba8863280 100644
@@ -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);
 }
 
 /**
ui/gtk.c +1 -2
index 030b251c6109..83f2f5d49b2a 100644
@@ -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)
util/qemu-sockets.c +1 -4
index bcc06d0e01c7..86c48b9fa5de 100644
@@ -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,
Signature · 1 line
2.26.2
#9 lore raw

[PULL 04/20] crypto: Redundant type conversion for AES_KEY pointer

In reply to Laurent Vivier

From: Chen Qun <[email protected]>

Fix: eaec903c5b8

Message-Id: <[email protected]>

---
 crypto/cipher-builtin.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
crypto/cipher-builtin.c +2 -4
index bf8413e71a6e..99d6280a1669 100644
@@ -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);
 }
 
 
Signature · 1 line
2.26.2
#10 lore raw

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".

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.

Quoted 41 lines · Laurent Vivier

From: Chen Qun <[email protected]>

Fix: eaec903c5b8

Message-Id: <[email protected]>

---
 crypto/cipher-builtin.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
crypto/cipher-builtin.c +2 -4
index bf8413e71a6e..99d6280a1669 100644
@@ -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);
 }
 
 
Signature · 1 line
2.26.2

Regards,
Daniel

Signature · 3 lines
|: 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 :|
#11 lore raw

RE: [PULL 04/20] crypto: Redundant type conversion for AES_KEY pointer

Quoted 10 lines

-----Original Message-----
From: Daniel P. Berrangé [mailto:[email protected]]
Sent: Monday, May 4, 2020 8:58 PM
To: Chenqun (kuhn) <[email protected]>
Cc: [email protected]; Michael Tokarev <[email protected]>; qemu- [email protected]; Laurent Vivier <[email protected]>; Euler Robot <[email protected]>
Subject: Re: [PULL 04/20] crypto: Redundant type conversion for AES_KEY pointer

Quoted 8 lines

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.

Quoted 4 lines

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.

#12 lore raw

[PULL 07/20] hw/mem/pc-dimm: Fix line over 80 characters warning

In reply to Laurent Vivier

From: Wainer dos Santos Moschetta <[email protected]>

Message-Id: <[email protected]>

---
 hw/mem/pc-dimm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/mem/pc-dimm.c +2 -1
index 36edfcf46799..6d62588fea8c 100644
@@ -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,
Signature · 1 line
2.26.2
#13 lore raw

[PULL 14/20] hw/i2c/pm_smbus: Remove dead assignment

In reply to Laurent Vivier

From: Philippe Mathieu-Daudé <[email protected]>

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

Message-Id: <[email protected]>

---
 hw/i2c/pm_smbus.c | 1 -
 1 file changed, 1 deletion(-)
hw/i2c/pm_smbus.c +0 -1
index 36994ff5857c..4728540c37e6 100644
@@ -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;
         }
Signature · 1 line
2.26.2
#14 lore raw

[PULL 18/20] hw/gpio/aspeed_gpio: Remove dead assignment

In reply to Laurent Vivier

From: Philippe Mathieu-Daudé <[email protected]>

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

Message-Id: <[email protected]>

---
 hw/gpio/aspeed_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/gpio/aspeed_gpio.c +1 -1
index e52fcfd9a030..4c75b5c80cc9 100644
@@ -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];
Signature · 1 line
2.26.2
#15 lore raw

[PULL 08/20] elf_ops: Don't try to g_mapped_file_unref(NULL)

In reply to Laurent Vivier

From: Peter Maydell <[email protected]>

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".

Message-Id: <[email protected]>

---
 include/hw/elf_ops.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/hw/elf_ops.h +3 -1
index e0bb47bb678d..398a4a2c85bb 100644
@@ -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;
 }
Signature · 1 line
2.26.2
#16 lore raw

[PULL 05/20] MAINTAINERS: Mark the LatticeMico32 target as orphan

In reply to Laurent Vivier

From: Philippe Mathieu-Daudé <[email protected]>

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/[email protected]/msg605024.html

Message-Id: <[email protected]>

---
 MAINTAINERS | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
MAINTAINERS +6 -6
index 8aa8efaf1d7f..d6886be13159 100644
@@ -184,8 +184,8 @@ F: hw/net/*i82596*
 F: include/hw/net/lasi_82596.h
 
 LM32 TCG CPUs
-M: Michael Walle <[email protected]>
-S: Maintained
+R: Michael Walle <[email protected]>
+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 <[email protected]>
-S: Maintained
+R: Michael Walle <[email protected]>
+S: Orphan
 F: hw/lm32/lm32_boards.c
 
 milkymist
-M: Michael Walle <[email protected]>
-S: Maintained
+R: Michael Walle <[email protected]>
+S: Orphan
 F: hw/lm32/milkymist.c
 
 M68K Machines
Signature · 1 line
2.26.2
#17 lore raw

[PULL 16/20] hw/ide/sii3112: Remove dead assignment

In reply to Laurent Vivier

From: Philippe Mathieu-Daudé <[email protected]>

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

Message-Id: <[email protected]>

---
 hw/ide/sii3112.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/ide/sii3112.c +3 -2
index d69079c3d9b7..94d2b57f9535 100644
@@ -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;
     }
 }
 
Signature · 1 line
2.26.2
#18 lore raw

[PULL 12/20] block: Avoid dead assignment

In reply to Laurent Vivier

From: Philippe Mathieu-Daudé <[email protected]>

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);
      ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message-Id: <[email protected]>

---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block.c +1 -1
index 301ec588bda2..cf5c19b1db49 100644
@@ -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;
     }
 
Signature · 1 line
2.26.2
#19 lore raw

[PULL 19/20] hw/timer/stm32f2xx_timer: Remove dead assignment

In reply to Laurent Vivier

From: Philippe Mathieu-Daudé <[email protected]>

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

Message-Id: <[email protected]>

---
 hw/timer/stm32f2xx_timer.c | 1 -
 1 file changed, 1 deletion(-)
hw/timer/stm32f2xx_timer.c +0 -1
index 06ec8a02c250..ba8694dcd349 100644
@@ -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;
Signature · 1 line
2.26.2
#20 lore raw

[PULL 20/20] hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning

In reply to Laurent Vivier

From: Philippe Mathieu-Daudé <[email protected]>

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

Message-Id: <[email protected]>

---
 hw/timer/pxa2xx_timer.c | 1 +
 1 file changed, 1 insertion(+)
hw/timer/pxa2xx_timer.c +1 -0
index cd172cc1e960..944c16588926 100644
@@ -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
Signature · 1 line
2.26.2
#21 lore raw

[PULL 17/20] hw/isa/i82378: Remove dead assignment

In reply to Laurent Vivier

From: Philippe Mathieu-Daudé <[email protected]>

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

Message-Id: <[email protected]>

---
 hw/isa/i82378.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/isa/i82378.c +4 -4
index dcb6b479ea0d..d9e6c7fa0096 100644
@@ -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)
Signature · 1 line
2.26.2
#22 lore raw

[PULL 15/20] hw/input/adb-kbd: Remove dead assignment

In reply to Laurent Vivier

From: Philippe Mathieu-Daudé <[email protected]>

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

Message-Id: <[email protected]>

---
 hw/input/adb-kbd.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
hw/input/adb-kbd.c +1 -5
index 0ba82075897f..a6d5c9b7c9ac 100644
@@ -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,
Signature · 1 line
2.26.2
#23 lore raw
In reply to Laurent Vivier
Quoted 15 lines · 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)

Quoted 8 lines

----------------------------------------------------------------
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

#24 lore raw

Le 04/05/2020 à 14:17, Peter Maydell a écrit :

Quoted 55 lines · Laurent Vivier
Quoted 15 lines

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)

Quoted 8 lines

----------------------------------------------------------------
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]

Quoted 7 lines
     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

#25 lore raw
In reply to Peter Maydell
Quoted 55 lines · Peter Maydell
Quoted 15 lines · 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)

Quoted 8 lines

----------------------------------------------------------------
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]

Quoted 7 lines
     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

Signature · 3 lines
|: 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 :|
#26 lore raw
In reply to Peter Maydell
Quoted 27 lines · Peter Maydell
Quoted 15 lines · 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)

Quoted 8 lines

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

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

Quoted 6 lines

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

#27 lore raw

Le 04/05/2020 à 14:34, Peter Maydell a écrit :

Quoted 35 lines · Peter Maydell
Quoted 27 lines · Laurent Vivier
Quoted 15 lines

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)

Quoted 8 lines

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

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

Quoted 6 lines

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

    int ret;
        ^
Quoted 2 lines

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