From e811da819a3284e1908dc6f5ce6761ff023d2366 Mon Sep 17 00:00:00 2001 From: liuxiangdong Date: Tue, 8 Feb 2022 21:11:45 +0800 Subject: [PATCH] qemu-6.2.0 compilation init add net-dump.c-Suppress-spurious-compiler-warning.patch (cherry picked from commit ae364c45a7ff5c1ff210f4206b617dc21992c599) --- ...c-Suppress-spurious-compiler-warning.patch | 51 +++++++++++++++++++ qemu.spec | 7 ++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 net-dump.c-Suppress-spurious-compiler-warning.patch diff --git a/net-dump.c-Suppress-spurious-compiler-warning.patch b/net-dump.c-Suppress-spurious-compiler-warning.patch new file mode 100644 index 00000000..5db07d34 --- /dev/null +++ b/net-dump.c-Suppress-spurious-compiler-warning.patch @@ -0,0 +1,51 @@ +From 08801d190afd21f7d3db9a2cdce2b1528903ac2c Mon Sep 17 00:00:00 2001 +From: liuxiangdong +Date: Tue, 8 Feb 2022 15:10:25 +0800 +Subject: [PATCH] net/dump.c: Suppress spurious compiler warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Compiling with gcc version 11.2.0 (Ubuntu 11.2.0-13ubuntu1) results in +a (spurious) warning: + + In function ‘dump_receive_iov’, + inlined from ‘filter_dump_receive_iov’ at ../net/dump.c:157:5: + ../net/dump.c:89:9: error: ‘writev’ specified size 18446744073709551600 +exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=] + 89 | if (writev(s->fd, dumpiov, cnt + 1) != sizeof(hdr) + caplen) { + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + In file included from /home/ptomsich/qemu/include/qemu/osdep.h:108, + from ../net/dump.c:25: + ../net/dump.c: In function ‘filter_dump_receive_iov’: + /usr/include/x86_64-linux-gnu/sys/uio.h:52:16: note: in a call to function +‘writev’ declared with attribute ‘read_only (2, 3)’ + 52 | extern ssize_t writev (int __fd, const struct iovec *__iovec, int +__count) + | ^~~~~~ + cc1: all warnings being treated as errors + +This change helps that version of GCC to understand what is going on +and suppresses this warning. + +Signed-off-by: Philipp Tomsich +--- + net/dump.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/dump.c b/net/dump.c +index a07ba62401..c32d3bf4e6 100644 +--- a/net/dump.c ++++ b/net/dump.c +@@ -86,7 +86,7 @@ static ssize_t dump_receive_iov(DumpState *s, const struct iovec *iov, int cnt) + dumpiov[0].iov_len = sizeof(hdr); + cnt = iov_copy(&dumpiov[1], cnt, iov, cnt, 0, caplen); + +- if (writev(s->fd, dumpiov, cnt + 1) != sizeof(hdr) + caplen) { ++ if (writev(s->fd, &dumpiov[0], cnt + 1) != sizeof(hdr) + caplen) { + error_report("network dump write error - stopping dump"); + close(s->fd); + s->fd = -1; +-- +2.27.0 + diff --git a/qemu.spec b/qemu.spec index 4efe98fb..4f67145f 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,6 +1,6 @@ Name: qemu Version: 6.2.0 -Release: 1 +Release: 2 Epoch: 2 Summary: QEMU is a generic and open source machine emulator and virtualizer License: GPLv2 and BSD and MIT and CC-BY-SA-4.0 @@ -10,6 +10,8 @@ Source1: 80-kvm.rules Source2: 99-qemu-guest-agent.rules Source3: bridge.conf +Patch0001: net-dump.c-Suppress-spurious-compiler-warning.patch + BuildRequires: flex BuildRequires: gcc BuildRequires: bison @@ -451,5 +453,8 @@ getent passwd qemu >/dev/null || \ %endif %changelog +* Tue Feb 8 2022 Xiangdong Liu +- net/dump.c: Suppress spurious compiler warning + * Thu Jan 27 2022 Xiangdong Liu - Package init -- Gitee