qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-6.1? v2 0/9] Fixes for clang-13
@ 2021-07-25 12:24 Richard Henderson
  2021-07-25 12:24 ` [PATCH for-6.1? v2 1/9] nbd/server: Mark variable unused in nbd_negotiate_meta_queries Richard Henderson
                   ` (9 more replies)
  0 siblings, 10 replies; 18+ messages in thread
From: Richard Henderson @ 2021-07-25 12:24 UTC (permalink / raw)
  To: qemu-devel

These are all "variable set but not used" Werrors when building
with clang master.

Patch 1 is clearly a clang bug, not considering the side-effects
of g_autofree, but the rest are legitimate.


r~


Richard Henderson (9):
  nbd/server: Mark variable unused in nbd_negotiate_meta_queries
  accel/tcg: Remove unused variable in cpu_exec
  util/selfmap: Discard mapping on error
  net/checksum: Remove unused variable in net_checksum_add_iov
  hw/audio/adlib: Remove unused variable in adlib_callback
  hw/ppc/spapr_events: Remove unused variable from check_exception
  hw/pci-hist/pnv_phb4: Fix typo in pnv_phb4_ioda_write
  linux-user/syscall: Remove unused variable from execve
  tests/unit: Remove unused variable from test_io

 accel/tcg/cpu-exec.c   | 10 ++--------
 hw/audio/adlib.c       |  3 +--
 hw/pci-host/pnv_phb4.c |  2 +-
 hw/ppc/spapr_events.c  |  5 -----
 linux-user/syscall.c   |  3 ---
 nbd/server.c           |  3 ++-
 net/checksum.c         |  4 +---
 tests/unit/test-iov.c  |  5 +----
 util/selfmap.c         | 29 +++++++++++++++++------------
 9 files changed, 25 insertions(+), 39 deletions(-)

-- 
2.25.1



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

* [PATCH for-6.1? v2 1/9] nbd/server: Mark variable unused in nbd_negotiate_meta_queries
  2021-07-25 12:24 [PATCH for-6.1? v2 0/9] Fixes for clang-13 Richard Henderson
@ 2021-07-25 12:24 ` Richard Henderson
  2021-07-26 10:16   ` Vladimir Sementsov-Ogievskiy
  2021-07-26 14:53   ` Eric Blake
  2021-07-25 12:24 ` [PATCH for-6.1? v2 2/9] accel/tcg: Remove unused variable in cpu_exec Richard Henderson
                   ` (8 subsequent siblings)
  9 siblings, 2 replies; 18+ messages in thread
From: Richard Henderson @ 2021-07-25 12:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Vladimir Sementsov-Ogievskiy, Eric Blake, qemu-block

From clang-13:
nbd/server.c:976:22: error: variable 'bitmaps' set but not used \
    [-Werror,-Wunused-but-set-variable]

which is incorrect; see //bugs.llvm.org/show_bug.cgi?id=3888.

Cc: qemu-block@nongnu.org
Cc: Eric Blake <eblake@redhat.com>
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 nbd/server.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nbd/server.c b/nbd/server.c
index b60ebc3ab6..3927f7789d 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -973,7 +973,8 @@ static int nbd_negotiate_meta_queries(NBDClient *client,
 {
     int ret;
     g_autofree char *export_name = NULL;
-    g_autofree bool *bitmaps = NULL;
+    /* Mark unused to work around https://bugs.llvm.org/show_bug.cgi?id=3888 */
+    g_autofree G_GNUC_UNUSED bool *bitmaps = NULL;
     NBDExportMetaContexts local_meta = {0};
     uint32_t nb_queries;
     size_t i;
-- 
2.25.1



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

* [PATCH for-6.1? v2 2/9] accel/tcg: Remove unused variable in cpu_exec
  2021-07-25 12:24 [PATCH for-6.1? v2 0/9] Fixes for clang-13 Richard Henderson
  2021-07-25 12:24 ` [PATCH for-6.1? v2 1/9] nbd/server: Mark variable unused in nbd_negotiate_meta_queries Richard Henderson
@ 2021-07-25 12:24 ` Richard Henderson
  2021-07-25 12:24 ` [PATCH for-6.1? v2 3/9] util/selfmap: Discard mapping on error Richard Henderson
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2021-07-25 12:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé

From clang-13:
accel/tcg/cpu-exec.c:783:15: error: variable 'cc' set but not used \
    [-Werror,-Wunused-but-set-variable]

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 accel/tcg/cpu-exec.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index fc895cf51e..1c6f684cb0 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -853,7 +853,6 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb,
 
 int cpu_exec(CPUState *cpu)
 {
-    CPUClass *cc = CPU_GET_CLASS(cpu);
     int ret;
     SyncClocks sc = { 0 };
 
@@ -887,19 +886,14 @@ int cpu_exec(CPUState *cpu)
          * that we support, but is still unfixed in clang:
          *   https://bugs.llvm.org/show_bug.cgi?id=21183
          *
-         * Reload essential local variables here for those compilers.
+         * Reload an essential local variable here for those compilers.
          * Newer versions of gcc would complain about this code (-Wclobbered),
          * so we only perform the workaround for clang.
          */
         cpu = current_cpu;
-        cc = CPU_GET_CLASS(cpu);
 #else
-        /*
-         * Non-buggy compilers preserve these locals; assert that
-         * they have the correct value.
-         */
+        /* Non-buggy compilers preserve this; assert the correct value. */
         g_assert(cpu == current_cpu);
-        g_assert(cc == CPU_GET_CLASS(cpu));
 #endif
 
 #ifndef CONFIG_SOFTMMU
-- 
2.25.1



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

* [PATCH for-6.1? v2 3/9] util/selfmap: Discard mapping on error
  2021-07-25 12:24 [PATCH for-6.1? v2 0/9] Fixes for clang-13 Richard Henderson
  2021-07-25 12:24 ` [PATCH for-6.1? v2 1/9] nbd/server: Mark variable unused in nbd_negotiate_meta_queries Richard Henderson
  2021-07-25 12:24 ` [PATCH for-6.1? v2 2/9] accel/tcg: Remove unused variable in cpu_exec Richard Henderson
@ 2021-07-25 12:24 ` Richard Henderson
  2021-07-26 15:37   ` Eric Blake
  2021-07-25 12:24 ` [PATCH for-6.1? v2 4/9] net/checksum: Remove unused variable in net_checksum_add_iov Richard Henderson
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Richard Henderson @ 2021-07-25 12:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

From clang-13:
util/selfmap.c:26:21: error: variable 'errors' set but not used \
    [-Werror,-Wunused-but-set-variable]

Quite right of course, but there's no reason not to check errors.

First, incrementing errors is incorrect, because qemu_strtoul
returns an errno not a count -- just or them together so that
we have a non-zero value at the end.

Second, if we have an error, do not add the struct to the list,
but free it instead.

Cc: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 util/selfmap.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/util/selfmap.c b/util/selfmap.c
index 2ec99dfdda..2c14f019ce 100644
--- a/util/selfmap.c
+++ b/util/selfmap.c
@@ -23,29 +23,34 @@ GSList *read_self_maps(void)
             gchar **fields = g_strsplit(lines[i], " ", 6);
             if (g_strv_length(fields) > 4) {
                 MapInfo *e = g_new0(MapInfo, 1);
-                int errors;
+                int errors = 0;
                 const char *end;
 
-                errors  = qemu_strtoul(fields[0], &end, 16, &e->start);
-                errors += qemu_strtoul(end + 1, NULL, 16, &e->end);
+                errors |= qemu_strtoul(fields[0], &end, 16, &e->start);
+                errors |= qemu_strtoul(end + 1, NULL, 16, &e->end);
 
                 e->is_read  = fields[1][0] == 'r';
                 e->is_write = fields[1][1] == 'w';
                 e->is_exec  = fields[1][2] == 'x';
                 e->is_priv  = fields[1][3] == 'p';
 
-                errors += qemu_strtoul(fields[2], NULL, 16, &e->offset);
+                errors |= qemu_strtoul(fields[2], NULL, 16, &e->offset);
                 e->dev = g_strdup(fields[3]);
-                errors += qemu_strtou64(fields[4], NULL, 10, &e->inode);
+                errors |= qemu_strtou64(fields[4], NULL, 10, &e->inode);
 
-                /*
-                 * The last field may have leading spaces which we
-                 * need to strip.
-                 */
-                if (g_strv_length(fields) == 6) {
-                    e->path = g_strdup(g_strchug(fields[5]));
+                if (!errors) {
+                    /*
+                     * The last field may have leading spaces which we
+                     * need to strip.
+                     */
+                    if (g_strv_length(fields) == 6) {
+                        e->path = g_strdup(g_strchug(fields[5]));
+                    }
+                    map_info = g_slist_prepend(map_info, e);
+                } else {
+                    g_free(e->dev);
+                    g_free(e);
                 }
-                map_info = g_slist_prepend(map_info, e);
             }
 
             g_strfreev(fields);
-- 
2.25.1



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

* [PATCH for-6.1? v2 4/9] net/checksum: Remove unused variable in net_checksum_add_iov
  2021-07-25 12:24 [PATCH for-6.1? v2 0/9] Fixes for clang-13 Richard Henderson
                   ` (2 preceding siblings ...)
  2021-07-25 12:24 ` [PATCH for-6.1? v2 3/9] util/selfmap: Discard mapping on error Richard Henderson
@ 2021-07-25 12:24 ` Richard Henderson
  2021-07-26 15:38   ` Eric Blake
  2021-07-25 12:24 ` [PATCH for-6.1? v2 5/9] hw/audio/adlib: Remove unused variable in adlib_callback Richard Henderson
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Richard Henderson @ 2021-07-25 12:24 UTC (permalink / raw)
  To: qemu-devel

From clang-13:
../qemu/net/checksum.c:189:23: error: variable 'buf_off' set but not used \
    [-Werror,-Wunused-but-set-variable]

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 net/checksum.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/checksum.c b/net/checksum.c
index 70f4eaeb3a..68245fd748 100644
--- a/net/checksum.c
+++ b/net/checksum.c
@@ -186,12 +186,11 @@ uint32_t
 net_checksum_add_iov(const struct iovec *iov, const unsigned int iov_cnt,
                      uint32_t iov_off, uint32_t size, uint32_t csum_offset)
 {
-    size_t iovec_off, buf_off;
+    size_t iovec_off;
     unsigned int i;
     uint32_t res = 0;
 
     iovec_off = 0;
-    buf_off = 0;
     for (i = 0; i < iov_cnt && size; i++) {
         if (iov_off < (iovec_off + iov[i].iov_len)) {
             size_t len = MIN((iovec_off + iov[i].iov_len) - iov_off , size);
@@ -200,7 +199,6 @@ net_checksum_add_iov(const struct iovec *iov, const unsigned int iov_cnt,
             res += net_checksum_add_cont(len, chunk_buf, csum_offset);
             csum_offset += len;
 
-            buf_off += len;
             iov_off += len;
             size -= len;
         }
-- 
2.25.1



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

* [PATCH for-6.1? v2 5/9] hw/audio/adlib: Remove unused variable in adlib_callback
  2021-07-25 12:24 [PATCH for-6.1? v2 0/9] Fixes for clang-13 Richard Henderson
                   ` (3 preceding siblings ...)
  2021-07-25 12:24 ` [PATCH for-6.1? v2 4/9] net/checksum: Remove unused variable in net_checksum_add_iov Richard Henderson
@ 2021-07-25 12:24 ` Richard Henderson
  2021-07-25 12:24 ` [PATCH for-6.1? v2 6/9] hw/ppc/spapr_events: Remove unused variable from check_exception Richard Henderson
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2021-07-25 12:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé

From clang-13:
hw/audio/adlib.c:189:18: error: variable 'net' set but not used \
    [-Werror,-Wunused-but-set-variable]

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 hw/audio/adlib.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
index 42d50d2fdc..5f979b1487 100644
--- a/hw/audio/adlib.c
+++ b/hw/audio/adlib.c
@@ -186,7 +186,7 @@ static int write_audio (AdlibState *s, int samples)
 static void adlib_callback (void *opaque, int free)
 {
     AdlibState *s = opaque;
-    int samples, net = 0, to_play, written;
+    int samples, to_play, written;
 
     samples = free >> SHIFT;
     if (!(s->active && s->enabled) || !samples) {
@@ -219,7 +219,6 @@ static void adlib_callback (void *opaque, int free)
         written = write_audio (s, samples);
 
         if (written) {
-            net += written;
             samples -= written;
             s->pos = (s->pos + written) % s->samples;
         }
-- 
2.25.1



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

* [PATCH for-6.1? v2 6/9] hw/ppc/spapr_events: Remove unused variable from check_exception
  2021-07-25 12:24 [PATCH for-6.1? v2 0/9] Fixes for clang-13 Richard Henderson
                   ` (4 preceding siblings ...)
  2021-07-25 12:24 ` [PATCH for-6.1? v2 5/9] hw/audio/adlib: Remove unused variable in adlib_callback Richard Henderson
@ 2021-07-25 12:24 ` Richard Henderson
  2021-07-25 12:24 ` [PATCH for-6.1? v2 7/9] hw/pci-hist/pnv_phb4: Fix typo in pnv_phb4_ioda_write Richard Henderson
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2021-07-25 12:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: David Gibson

From clang-13:
hw/ppc/spapr_events.c:937:14: error: variable 'xinfo' set but not used \
    [-Werror,-Wunused-but-set-variable]

Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 hw/ppc/spapr_events.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
index 0cfc19be19..23e2e2fff1 100644
--- a/hw/ppc/spapr_events.c
+++ b/hw/ppc/spapr_events.c
@@ -934,7 +934,6 @@ static void check_exception(PowerPCCPU *cpu, SpaprMachineState *spapr,
                             uint32_t nret, target_ulong rets)
 {
     uint32_t mask, buf, len, event_len;
-    uint64_t xinfo;
     SpaprEventLogEntry *event;
     struct rtas_error_log header;
     int i;
@@ -944,13 +943,9 @@ static void check_exception(PowerPCCPU *cpu, SpaprMachineState *spapr,
         return;
     }
 
-    xinfo = rtas_ld(args, 1);
     mask = rtas_ld(args, 2);
     buf = rtas_ld(args, 4);
     len = rtas_ld(args, 5);
-    if (nargs == 7) {
-        xinfo |= (uint64_t)rtas_ld(args, 6) << 32;
-    }
 
     event = rtas_event_log_dequeue(spapr, mask);
     if (!event) {
-- 
2.25.1



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

* [PATCH for-6.1? v2 7/9] hw/pci-hist/pnv_phb4: Fix typo in pnv_phb4_ioda_write
  2021-07-25 12:24 [PATCH for-6.1? v2 0/9] Fixes for clang-13 Richard Henderson
                   ` (5 preceding siblings ...)
  2021-07-25 12:24 ` [PATCH for-6.1? v2 6/9] hw/ppc/spapr_events: Remove unused variable from check_exception Richard Henderson
@ 2021-07-25 12:24 ` Richard Henderson
  2021-07-25 21:27   ` Philippe Mathieu-Daudé
  2021-07-25 12:24 ` [PATCH for-6.1? v2 8/9] linux-user/syscall: Remove unused variable from execve Richard Henderson
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Richard Henderson @ 2021-07-25 12:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: David Gibson

From clang-13:
hw/pci-host/pnv_phb4.c:375:18: error: variable 'v' set but not used \
    [-Werror,-Wunused-but-set-variable]

It's pretty clear that we meant to write back 'v' after
all that computation and not 'val'.

Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 hw/pci-host/pnv_phb4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 54f57c660a..5c375a9f28 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -392,7 +392,7 @@ static void pnv_phb4_ioda_write(PnvPHB4 *phb, uint64_t val)
             v &= 0xffffffffffff0000ull;
             v |= 0x000000000000cfffull & val;
         }
-        *tptr = val;
+        *tptr = v;
         break;
     }
     case IODA3_TBL_MBT:
-- 
2.25.1



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

* [PATCH for-6.1? v2 8/9] linux-user/syscall: Remove unused variable from execve
  2021-07-25 12:24 [PATCH for-6.1? v2 0/9] Fixes for clang-13 Richard Henderson
                   ` (6 preceding siblings ...)
  2021-07-25 12:24 ` [PATCH for-6.1? v2 7/9] hw/pci-hist/pnv_phb4: Fix typo in pnv_phb4_ioda_write Richard Henderson
@ 2021-07-25 12:24 ` Richard Henderson
  2021-07-25 12:24 ` [PATCH for-6.1? v2 9/9] tests/unit: Remove unused variable from test_io Richard Henderson
  2021-07-26 17:10 ` [PATCH for-6.1? v2 0/9] Fixes for clang-13 Richard Henderson
  9 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2021-07-25 12:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier

From clang-13:
linux-user/syscall.c:8503:17: error: variable 'total_size' set but not used \
    [-Werror,-Wunused-but-set-variable]

Acked-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/syscall.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 376629c689..ccd3892b2d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8364,7 +8364,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
             abi_ulong guest_envp;
             abi_ulong addr;
             char **q;
-            int total_size = 0;
 
             argc = 0;
             guest_argp = arg2;
@@ -8396,7 +8395,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
                     break;
                 if (!(*q = lock_user_string(addr)))
                     goto execve_efault;
-                total_size += strlen(*q) + 1;
             }
             *q = NULL;
 
@@ -8408,7 +8406,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
                     break;
                 if (!(*q = lock_user_string(addr)))
                     goto execve_efault;
-                total_size += strlen(*q) + 1;
             }
             *q = NULL;
 
-- 
2.25.1



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

* [PATCH for-6.1? v2 9/9] tests/unit: Remove unused variable from test_io
  2021-07-25 12:24 [PATCH for-6.1? v2 0/9] Fixes for clang-13 Richard Henderson
                   ` (7 preceding siblings ...)
  2021-07-25 12:24 ` [PATCH for-6.1? v2 8/9] linux-user/syscall: Remove unused variable from execve Richard Henderson
@ 2021-07-25 12:24 ` Richard Henderson
  2021-07-26 17:10 ` [PATCH for-6.1? v2 0/9] Fixes for clang-13 Richard Henderson
  9 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2021-07-25 12:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé

From clang-13:
tests/unit/test-iov.c:161:26: error: variable 't' set but not used \
    [-Werror,-Wunused-but-set-variable]

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tests/unit/test-iov.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tests/unit/test-iov.c b/tests/unit/test-iov.c
index 9c415e2f1f..5371066fb6 100644
--- a/tests/unit/test-iov.c
+++ b/tests/unit/test-iov.c
@@ -158,7 +158,7 @@ static void test_io(void)
 
     int sv[2];
     int r;
-    unsigned i, j, k, s, t;
+    unsigned i, j, k, s;
     fd_set fds;
     unsigned niov;
     struct iovec *iov, *siov;
@@ -182,7 +182,6 @@ static void test_io(void)
 
     FD_ZERO(&fds);
 
-    t = 0;
     if (fork() == 0) {
        /* writer */
 
@@ -201,7 +200,6 @@ static void test_io(void)
                    g_assert(memcmp(iov, siov, sizeof(*iov)*niov) == 0);
                    if (r >= 0) {
                        k += r;
-                       t += r;
                        usleep(g_test_rand_int_range(0, 30));
                    } else if (errno == EAGAIN) {
                        select(sv[1]+1, NULL, &fds, NULL, NULL);
@@ -238,7 +236,6 @@ static void test_io(void)
                    g_assert(memcmp(iov, siov, sizeof(*iov)*niov) == 0);
                    if (r > 0) {
                        k += r;
-                       t += r;
                    } else if (!r) {
                        if (s) {
                            break;
-- 
2.25.1



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

* Re: [PATCH for-6.1? v2 7/9] hw/pci-hist/pnv_phb4: Fix typo in pnv_phb4_ioda_write
  2021-07-25 12:24 ` [PATCH for-6.1? v2 7/9] hw/pci-hist/pnv_phb4: Fix typo in pnv_phb4_ioda_write Richard Henderson
@ 2021-07-25 21:27   ` Philippe Mathieu-Daudé
  2021-07-26  4:58     ` Benjamin Herrenschmidt
  2021-07-26  6:58     ` Cédric Le Goater
  0 siblings, 2 replies; 18+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-07-25 21:27 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: Cédric Le Goater, David Gibson

+Cédric/Benjamin

On 7/25/21 2:24 PM, Richard Henderson wrote:
> From clang-13:
> hw/pci-host/pnv_phb4.c:375:18: error: variable 'v' set but not used \
>     [-Werror,-Wunused-but-set-variable]
> 
> It's pretty clear that we meant to write back 'v' after
> all that computation and not 'val'.
> 

Fixes: 4f9924c4d4c ("ppc/pnv: Add models for POWER9 PHB4 PCIe Host bridge")

> Acked-by: David Gibson <david@gibson.dropbear.id.au>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  hw/pci-host/pnv_phb4.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
> index 54f57c660a..5c375a9f28 100644
> --- a/hw/pci-host/pnv_phb4.c
> +++ b/hw/pci-host/pnv_phb4.c
> @@ -392,7 +392,7 @@ static void pnv_phb4_ioda_write(PnvPHB4 *phb, uint64_t val)
>              v &= 0xffffffffffff0000ull;
>              v |= 0x000000000000cfffull & val;
>          }
> -        *tptr = val;
> +        *tptr = v;
>          break;
>      }
>      case IODA3_TBL_MBT:
> 



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

* Re: [PATCH for-6.1? v2 7/9] hw/pci-hist/pnv_phb4: Fix typo in pnv_phb4_ioda_write
  2021-07-25 21:27   ` Philippe Mathieu-Daudé
@ 2021-07-26  4:58     ` Benjamin Herrenschmidt
  2021-07-26  6:58     ` Cédric Le Goater
  1 sibling, 0 replies; 18+ messages in thread
From: Benjamin Herrenschmidt @ 2021-07-26  4:58 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Richard Henderson, qemu-devel
  Cc: Cédric Le Goater, David Gibson

On Sun, 2021-07-25 at 23:27 +0200, Philippe Mathieu-Daudé wrote:
> +Cédric/Benjamin
> 
> On 7/25/21 2:24 PM, Richard Henderson wrote:
> > From clang-13:
> > hw/pci-host/pnv_phb4.c:375:18: error: variable 'v' set but not used
> > \
> >     [-Werror,-Wunused-but-set-variable]
> > 
> > It's pretty clear that we meant to write back 'v' after
> > all that computation and not 'val'.
> > 
> 
> Fixes: 4f9924c4d4c ("ppc/pnv: Add models for POWER9 PHB4 PCIe Host
> bridge")

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> 
> > Acked-by: David Gibson <david@gibson.dropbear.id.au>
> > Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> > ---
> >  hw/pci-host/pnv_phb4.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
> > index 54f57c660a..5c375a9f28 100644
> > --- a/hw/pci-host/pnv_phb4.c
> > +++ b/hw/pci-host/pnv_phb4.c
> > @@ -392,7 +392,7 @@ static void pnv_phb4_ioda_write(PnvPHB4 *phb,
> > uint64_t val)
> >              v &= 0xffffffffffff0000ull;
> >              v |= 0x000000000000cfffull & val;
> >          }
> > -        *tptr = val;
> > +        *tptr = v;
> >          break;
> >      }
> >      case IODA3_TBL_MBT:
> > 



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

* Re: [PATCH for-6.1? v2 7/9] hw/pci-hist/pnv_phb4: Fix typo in pnv_phb4_ioda_write
  2021-07-25 21:27   ` Philippe Mathieu-Daudé
  2021-07-26  4:58     ` Benjamin Herrenschmidt
@ 2021-07-26  6:58     ` Cédric Le Goater
  1 sibling, 0 replies; 18+ messages in thread
From: Cédric Le Goater @ 2021-07-26  6:58 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Richard Henderson, qemu-devel; +Cc: David Gibson

On 7/25/21 11:27 PM, Philippe Mathieu-Daudé wrote:
> +Cédric/Benjamin
> 
> On 7/25/21 2:24 PM, Richard Henderson wrote:
>> From clang-13:
>> hw/pci-host/pnv_phb4.c:375:18: error: variable 'v' set but not used \
>>     [-Werror,-Wunused-but-set-variable]
>>
>> It's pretty clear that we meant to write back 'v' after
>> all that computation and not 'val'.
>>
> 
> Fixes: 4f9924c4d4c ("ppc/pnv: Add models for POWER9 PHB4 PCIe Host bridge")

I went through the code and the PHB4 specs and I guess we didn't 
see any issues before because the written data is properly formatted
in OPAL.

Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.

> 
>> Acked-by: David Gibson <david@gibson.dropbear.id.au>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>>  hw/pci-host/pnv_phb4.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
>> index 54f57c660a..5c375a9f28 100644
>> --- a/hw/pci-host/pnv_phb4.c
>> +++ b/hw/pci-host/pnv_phb4.c
>> @@ -392,7 +392,7 @@ static void pnv_phb4_ioda_write(PnvPHB4 *phb, uint64_t val)
>>              v &= 0xffffffffffff0000ull;
>>              v |= 0x000000000000cfffull & val;
>>          }
>> -        *tptr = val;
>> +        *tptr = v;
>>          break;
>>      }
>>      case IODA3_TBL_MBT:
>>
> 



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

* Re: [PATCH for-6.1? v2 1/9] nbd/server: Mark variable unused in nbd_negotiate_meta_queries
  2021-07-25 12:24 ` [PATCH for-6.1? v2 1/9] nbd/server: Mark variable unused in nbd_negotiate_meta_queries Richard Henderson
@ 2021-07-26 10:16   ` Vladimir Sementsov-Ogievskiy
  2021-07-26 14:53   ` Eric Blake
  1 sibling, 0 replies; 18+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2021-07-26 10:16 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-block, Eric Blake

25.07.2021 15:24, Richard Henderson wrote:
>  From clang-13:
> nbd/server.c:976:22: error: variable 'bitmaps' set but not used \
>      [-Werror,-Wunused-but-set-variable]
> 
> which is incorrect; see //bugs.llvm.org/show_bug.cgi?id=3888.
> 
> Cc:qemu-block@nongnu.org
> Cc: Eric Blake<eblake@redhat.com>
> Cc: Vladimir Sementsov-Ogievskiy<vsementsov@virtuozzo.com>
> Signed-off-by: Richard Henderson<richard.henderson@linaro.org>

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

-- 
Best regards,
Vladimir


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

* Re: [PATCH for-6.1? v2 1/9] nbd/server: Mark variable unused in nbd_negotiate_meta_queries
  2021-07-25 12:24 ` [PATCH for-6.1? v2 1/9] nbd/server: Mark variable unused in nbd_negotiate_meta_queries Richard Henderson
  2021-07-26 10:16   ` Vladimir Sementsov-Ogievskiy
@ 2021-07-26 14:53   ` Eric Blake
  1 sibling, 0 replies; 18+ messages in thread
From: Eric Blake @ 2021-07-26 14:53 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Vladimir Sementsov-Ogievskiy, qemu-devel, qemu-block

On Sun, Jul 25, 2021 at 02:24:08AM -1000, Richard Henderson wrote:
> From clang-13:
> nbd/server.c:976:22: error: variable 'bitmaps' set but not used \
>     [-Werror,-Wunused-but-set-variable]
> 
> which is incorrect; see //bugs.llvm.org/show_bug.cgi?id=3888.
> 
> Cc: qemu-block@nongnu.org
> Cc: Eric Blake <eblake@redhat.com>
> Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  nbd/server.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/nbd/server.c b/nbd/server.c
> index b60ebc3ab6..3927f7789d 100644
> --- a/nbd/server.c
> +++ b/nbd/server.c
> @@ -973,7 +973,8 @@ static int nbd_negotiate_meta_queries(NBDClient *client,
>  {
>      int ret;
>      g_autofree char *export_name = NULL;
> -    g_autofree bool *bitmaps = NULL;
> +    /* Mark unused to work around https://bugs.llvm.org/show_bug.cgi?id=3888 */
> +    g_autofree G_GNUC_UNUSED bool *bitmaps = NULL;

Reviewed-by: Eric Blake <eblake@redhat.com>

I'm not sure this one patch warrants a pull request by itself, but I'm
not opposed to including it in 6.1 if anything also turns up affecting
NBD.  If someone wants to pick up the entire series, that would work
too.  Otherwise, I can queue this individual patch through my NBD tree
for 6.2.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



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

* Re: [PATCH for-6.1? v2 3/9] util/selfmap: Discard mapping on error
  2021-07-25 12:24 ` [PATCH for-6.1? v2 3/9] util/selfmap: Discard mapping on error Richard Henderson
@ 2021-07-26 15:37   ` Eric Blake
  0 siblings, 0 replies; 18+ messages in thread
From: Eric Blake @ 2021-07-26 15:37 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Alex Bennée, qemu-devel

On Sun, Jul 25, 2021 at 02:24:10AM -1000, Richard Henderson wrote:
> From clang-13:
> util/selfmap.c:26:21: error: variable 'errors' set but not used \
>     [-Werror,-Wunused-but-set-variable]
> 
> Quite right of course, but there's no reason not to check errors.
> 
> First, incrementing errors is incorrect, because qemu_strtoul
> returns an errno not a count -- just or them together so that
> we have a non-zero value at the end.
> 
> Second, if we have an error, do not add the struct to the list,
> but free it instead.
> 
> Cc: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  util/selfmap.c | 29 +++++++++++++++++------------
>  1 file changed, 17 insertions(+), 12 deletions(-)
>

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



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

* Re: [PATCH for-6.1? v2 4/9] net/checksum: Remove unused variable in net_checksum_add_iov
  2021-07-25 12:24 ` [PATCH for-6.1? v2 4/9] net/checksum: Remove unused variable in net_checksum_add_iov Richard Henderson
@ 2021-07-26 15:38   ` Eric Blake
  0 siblings, 0 replies; 18+ messages in thread
From: Eric Blake @ 2021-07-26 15:38 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel

On Sun, Jul 25, 2021 at 02:24:11AM -1000, Richard Henderson wrote:
> From clang-13:
> ../qemu/net/checksum.c:189:23: error: variable 'buf_off' set but not used \
>     [-Werror,-Wunused-but-set-variable]
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  net/checksum.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



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

* Re: [PATCH for-6.1? v2 0/9] Fixes for clang-13
  2021-07-25 12:24 [PATCH for-6.1? v2 0/9] Fixes for clang-13 Richard Henderson
                   ` (8 preceding siblings ...)
  2021-07-25 12:24 ` [PATCH for-6.1? v2 9/9] tests/unit: Remove unused variable from test_io Richard Henderson
@ 2021-07-26 17:10 ` Richard Henderson
  9 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2021-07-26 17:10 UTC (permalink / raw)
  To: qemu-devel

On 7/25/21 2:24 AM, Richard Henderson wrote:
> 
> Richard Henderson (9):
>    nbd/server: Mark variable unused in nbd_negotiate_meta_queries
>    accel/tcg: Remove unused variable in cpu_exec
>    util/selfmap: Discard mapping on error
>    net/checksum: Remove unused variable in net_checksum_add_iov
>    hw/audio/adlib: Remove unused variable in adlib_callback
>    hw/ppc/spapr_events: Remove unused variable from check_exception
>    hw/pci-hist/pnv_phb4: Fix typo in pnv_phb4_ioda_write
>    linux-user/syscall: Remove unused variable from execve
>    tests/unit: Remove unused variable from test_io

Queued for 6.1.
Thanks for the reviews, all.

r~


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

end of thread, other threads:[~2021-07-26 17:12 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-25 12:24 [PATCH for-6.1? v2 0/9] Fixes for clang-13 Richard Henderson
2021-07-25 12:24 ` [PATCH for-6.1? v2 1/9] nbd/server: Mark variable unused in nbd_negotiate_meta_queries Richard Henderson
2021-07-26 10:16   ` Vladimir Sementsov-Ogievskiy
2021-07-26 14:53   ` Eric Blake
2021-07-25 12:24 ` [PATCH for-6.1? v2 2/9] accel/tcg: Remove unused variable in cpu_exec Richard Henderson
2021-07-25 12:24 ` [PATCH for-6.1? v2 3/9] util/selfmap: Discard mapping on error Richard Henderson
2021-07-26 15:37   ` Eric Blake
2021-07-25 12:24 ` [PATCH for-6.1? v2 4/9] net/checksum: Remove unused variable in net_checksum_add_iov Richard Henderson
2021-07-26 15:38   ` Eric Blake
2021-07-25 12:24 ` [PATCH for-6.1? v2 5/9] hw/audio/adlib: Remove unused variable in adlib_callback Richard Henderson
2021-07-25 12:24 ` [PATCH for-6.1? v2 6/9] hw/ppc/spapr_events: Remove unused variable from check_exception Richard Henderson
2021-07-25 12:24 ` [PATCH for-6.1? v2 7/9] hw/pci-hist/pnv_phb4: Fix typo in pnv_phb4_ioda_write Richard Henderson
2021-07-25 21:27   ` Philippe Mathieu-Daudé
2021-07-26  4:58     ` Benjamin Herrenschmidt
2021-07-26  6:58     ` Cédric Le Goater
2021-07-25 12:24 ` [PATCH for-6.1? v2 8/9] linux-user/syscall: Remove unused variable from execve Richard Henderson
2021-07-25 12:24 ` [PATCH for-6.1? v2 9/9] tests/unit: Remove unused variable from test_io Richard Henderson
2021-07-26 17:10 ` [PATCH for-6.1? v2 0/9] Fixes for clang-13 Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).