[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8.0.1 32/36] async: Suppress GCC13 false positive in aio_bh_poll
From: |
Michael Tokarev |
Subject: |
[PATCH v8.0.1 32/36] async: Suppress GCC13 false positive in aio_bh_poll() |
Date: |
Wed, 17 May 2023 11:00:52 +0300 |
From: Cédric Le Goater <clg@redhat.com>
GCC13 reports an error :
../util/async.c: In function ‘aio_bh_poll’:
include/qemu/queue.h:303:22: error: storing the address of local variable
‘slice’ in ‘*ctx.bh_slice_list.sqh_last’ [-Werror=dangling-pointer=]
303 | (head)->sqh_last = &(elm)->field.sqe_next;
\
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
../util/async.c:169:5: note: in expansion of macro ‘QSIMPLEQ_INSERT_TAIL’
169 | QSIMPLEQ_INSERT_TAIL(&ctx->bh_slice_list, &slice, next);
| ^~~~~~~~~~~~~~~~~~~~
../util/async.c:161:17: note: ‘slice’ declared here
161 | BHListSlice slice;
| ^~~~~
../util/async.c:161:17: note: ‘ctx’ declared here
But the local variable 'slice' is removed from the global context list
in following loop of the same routine. Add a pragma to silent GCC.
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20230420202939.1982044-1-clg@kaod.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit d66ba6dc1cce914673bd8a89fca30a7715ea70d1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: cherry-picked to stable-8.0 to eliminate CI failures on win*)
---
util/async.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/util/async.c b/util/async.c
index 21016a1ac7..856e1a8a33 100644
--- a/util/async.c
+++ b/util/async.c
@@ -164,7 +164,21 @@ int aio_bh_poll(AioContext *ctx)
/* Synchronizes with QSLIST_INSERT_HEAD_ATOMIC in aio_bh_enqueue(). */
QSLIST_MOVE_ATOMIC(&slice.bh_list, &ctx->bh_list);
+
+ /*
+ * GCC13 [-Werror=dangling-pointer=] complains that the local variable
+ * 'slice' is being stored in the global 'ctx->bh_slice_list' but the
+ * list is emptied before this function returns.
+ */
+#if !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpragmas"
+#pragma GCC diagnostic ignored "-Wdangling-pointer="
+#endif
QSIMPLEQ_INSERT_TAIL(&ctx->bh_slice_list, &slice, next);
+#if !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
while ((s = QSIMPLEQ_FIRST(&ctx->bh_slice_list))) {
QEMUBH *bh;
--
2.39.2
- [PATCH v8.0.1 24/36] block: Don't call no_coroutine_fns in qmp_block_resize(), (continued)
- [PATCH v8.0.1 24/36] block: Don't call no_coroutine_fns in qmp_block_resize(), Michael Tokarev, 2023/05/17
- [PATCH v8.0.1 13/36] hw/arm/raspi: Use arm_write_bootloader() to write boot code, Michael Tokarev, 2023/05/17
- [PATCH v8.0.1 17/36] hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields, Michael Tokarev, 2023/05/17
- [PATCH v8.0.1 28/36] accel/tcg: Fix atomic_mmu_lookup for reads, Michael Tokarev, 2023/05/17
- [PATCH v8.0.1 27/36] hw/pci-bridge: pci_expander_bridge fix type in pxb_cxl_dev_reset(), Michael Tokarev, 2023/05/17
- [PATCH v8.0.1 26/36] target/riscv: Restore the predicate() NULL check behavior, Michael Tokarev, 2023/05/17
- [PATCH v8.0.1 29/36] target/arm: Fix handling of SW and NSW bits for stage 2 walks, Michael Tokarev, 2023/05/17
- [PATCH v8.0.1 25/36] target/riscv: Fix itrigger when icount is used, Michael Tokarev, 2023/05/17
- [PATCH v8.0.1 30/36] ui: Fix pixel colour channel order for PNG screenshots, Michael Tokarev, 2023/05/17
- [PATCH v8.0.1 31/36] target/arm: Correct AArch64.S2MinTxSZ 32-bit EL1 input size check, Michael Tokarev, 2023/05/17
- [PATCH v8.0.1 32/36] async: Suppress GCC13 false positive in aio_bh_poll(),
Michael Tokarev <=
- [PATCH v8.0.1 33/36] tcg: ppc64: Fix mask generation for vextractdm, Michael Tokarev, 2023/05/17
- [PATCH v8.0.1 34/36] target/s390x: Fix EXECUTE of relative branches, Michael Tokarev, 2023/05/17
- [PATCH v8.0.1 35/36] 9pfs/xen: Fix segfault on shutdown, Michael Tokarev, 2023/05/17
- [PATCH v8.0.1 36/36] tcg/i386: Set P_REXW in tcg_out_addi_ptr, Michael Tokarev, 2023/05/17
- Re: [PATCH v8.0.1 00/36] Patch Round-up for stable 8.0.1, freeze on 2023-05-27, Thomas Huth, 2023/05/17
- Re: [PATCH v8.0.1 00/36] Patch Round-up for stable 8.0.1, freeze on 2023-05-27, Michael Tokarev, 2023/05/17
- Re: [PATCH v8.0.1 00/36] Patch Round-up for stable 8.0.1, freeze on 2023-05-27, Paolo Bonzini, 2023/05/17
- Re: [PATCH v8.0.1 00/36] Patch Round-up for stable 8.0.1, freeze on 2023-05-27, Eric Blake, 2023/05/18