From nobody Mon May 20 14:32:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671564560724366.3806187891646; Tue, 20 Dec 2022 11:29:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iGz-0004az-R3; Tue, 20 Dec 2022 14:27:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7iGy-0004ZN-1J for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:32 -0500 Received: from coyote.holtmann.net ([212.227.132.17] helo=mail.holtmann.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iGv-0002Z2-JN for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:31 -0500 Received: from fedora.. (p4fefcc21.dip0.t-ipconnect.de [79.239.204.33]) by mail.holtmann.org (Postfix) with ESMTPSA id 821A8CED0B; Tue, 20 Dec 2022 20:27:25 +0100 (CET) From: Marcel Holtmann To: qemu-devel@nongnu.org, mst@redhat.com, xieyongji@bytedance.com Cc: marcel@holtmann.org Subject: [PATCH v2 01/10] libvhost-user: Provide _GNU_SOURCE when compiling outside of QEMU Date: Tue, 20 Dec 2022 20:27:13 +0100 Message-Id: <9d286986fe538c3f7da8acad28f5ef3af0c4adc1.1671563795.git.marcel@holtmann.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=212.227.132.17; envelope-from=marcel@holtmann.org; helo=mail.holtmann.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1671564561774100001 Then the libvhost-user sources are used by another project, it can not be guaranteed that _GNU_SOURCE is set by the build system. If it is for example not set, errors like this show up. CC libvhost-user.o libvhost-user.c: In function =E2=80=98vu_panic=E2=80=99: libvhost-user.c:195:9: error: implicit declaration of function =E2=80=98vas= printf=E2=80=99; did you mean =E2=80=98vsprintf=E2=80=99? [-Werror=3Dimplic= it-function-declaration] 195 | if (vasprintf(&buf, msg, ap) < 0) { | ^~~~~~~~~ | vsprintf The simplest way to allow external complication of libvhost-user.[ch] is by setting _GNU_SOURCE if it is not already set by the build system. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvho= st-user/libvhost-user.c index d6ee6e7d9168..b55b9e244d9a 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -13,6 +13,10 @@ * later. See the COPYING file in the top-level directory. */ =20 +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + /* this code avoids GLib dependency */ #include #include --=20 2.38.1 From nobody Mon May 20 14:32:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671564520085143.66575885865768; Tue, 20 Dec 2022 11:28:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iGy-0004Zy-Ts; Tue, 20 Dec 2022 14:27:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7iGw-0004Z6-R3 for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:30 -0500 Received: from coyote.holtmann.net ([212.227.132.17] helo=mail.holtmann.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iGv-0002Yr-4t for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:30 -0500 Received: from fedora.. (p4fefcc21.dip0.t-ipconnect.de [79.239.204.33]) by mail.holtmann.org (Postfix) with ESMTPSA id B13B7CED0C; Tue, 20 Dec 2022 20:27:25 +0100 (CET) From: Marcel Holtmann To: qemu-devel@nongnu.org, mst@redhat.com, xieyongji@bytedance.com Cc: marcel@holtmann.org Subject: [PATCH v2 02/10] libvhost-user: Replace typeof with __typeof__ Date: Tue, 20 Dec 2022 20:27:14 +0100 Message-Id: <02a920e8501b0f63e799b8dd4f22528efe73f544.1671563795.git.marcel@holtmann.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=212.227.132.17; envelope-from=marcel@holtmann.org; helo=mail.holtmann.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1671564521594100003 Strictly speaking only -std=3Dgnu99 support the usage of typeof and for easier inclusion in external projects, it is better to use __typeof__. CC libvhost-user.o libvhost-user.c: In function =E2=80=98vu_log_queue_fill=E2=80=99: libvhost-user.c:86:13: error: implicit declaration of function =E2=80=98typ= eof=E2=80=99 [-Werror=3Dimplicit-function-declaration] 86 | typeof(x) _min1 =3D (x); \ | ^~~~~~ Changing these two users of typeof makes the compiler happy and no extra flags or pragmas need to be provided. Signed-off-by: Marcel Holtmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- subprojects/libvhost-user/libvhost-user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvho= st-user/libvhost-user.c index b55b9e244d9a..67d75ece53b7 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -62,8 +62,8 @@ #endif /* !__GNUC__ */ #ifndef MIN #define MIN(x, y) ({ \ - typeof(x) _min1 =3D (x); \ - typeof(y) _min2 =3D (y); \ + __typeof__(x) _min1 =3D (x); \ + __typeof__(y) _min2 =3D (y); \ (void) (&_min1 =3D=3D &_min2); \ _min1 < _min2 ? _min1 : _min2; }) #endif --=20 2.38.1 From nobody Mon May 20 14:32:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671564869216285.5888359381647; Tue, 20 Dec 2022 11:34:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iH0-0004bp-Kx; Tue, 20 Dec 2022 14:27:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7iGy-0004ZV-6j for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:32 -0500 Received: from coyote.holtmann.net ([212.227.132.17] helo=mail.holtmann.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iGv-0002Ys-UC for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:31 -0500 Received: from fedora.. (p4fefcc21.dip0.t-ipconnect.de [79.239.204.33]) by mail.holtmann.org (Postfix) with ESMTPSA id 155C6CED0D; Tue, 20 Dec 2022 20:27:26 +0100 (CET) From: Marcel Holtmann To: qemu-devel@nongnu.org, mst@redhat.com, xieyongji@bytedance.com Cc: marcel@holtmann.org Subject: [PATCH v2 03/10] libvhost-user: Cast rc variable to avoid compiler warning Date: Tue, 20 Dec 2022 20:27:15 +0100 Message-Id: <6ea3617a0508d0b0c488c9c0ce64fd1672b3e1ad.1671563795.git.marcel@holtmann.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=212.227.132.17; envelope-from=marcel@holtmann.org; helo=mail.holtmann.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1671564870524100001 The assert from recvmsg() return value against an uint32_t size field from a protocol struct throws a compiler warning. CC libvhost-user.o In file included from libvhost-user.c:27: libvhost-user.c: In function =E2=80=98vu_message_read_default=E2=80=99: libvhost-user.c:363:19: error: comparison of integer expressions of differe= nt signedness: =E2=80=98int=E2=80=99 and =E2=80=98uint32_t=E2=80=99 {aka = =E2=80=98unsigned int=E2=80=99} [-Werror=3Dsign-compare] 363 | assert(rc =3D=3D vmsg->size); | ^~ This is not critical, but annoying when the libvhost-user source are used in an external project that has this compiler warning switched on. Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvho= st-user/libvhost-user.c index 67d75ece53b7..bcdf32a24f60 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -339,7 +339,7 @@ vu_message_read_default(VuDev *dev, int conn_fd, VhostU= serMsg *vmsg) goto fail; } =20 - assert(rc =3D=3D vmsg->size); + assert((uint32_t)rc =3D=3D vmsg->size); } =20 return true; --=20 2.38.1 From nobody Mon May 20 14:32:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671564540499299.586531383959; Tue, 20 Dec 2022 11:29:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iGz-0004a1-2L; Tue, 20 Dec 2022 14:27:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7iGw-0004Z7-UE for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:30 -0500 Received: from coyote.holtmann.net ([212.227.132.17] helo=mail.holtmann.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iGv-0002Yu-Ed for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:30 -0500 Received: from fedora.. (p4fefcc21.dip0.t-ipconnect.de [79.239.204.33]) by mail.holtmann.org (Postfix) with ESMTPSA id 45947CED0E; Tue, 20 Dec 2022 20:27:26 +0100 (CET) From: Marcel Holtmann To: qemu-devel@nongnu.org, mst@redhat.com, xieyongji@bytedance.com Cc: marcel@holtmann.org Subject: [PATCH v2 04/10] libvhost-user: Use unsigned int i for some for-loop iterations Date: Tue, 20 Dec 2022 20:27:16 +0100 Message-Id: <5f46e4223710580e5d106b4d51226befa96e29ec.1671563795.git.marcel@holtmann.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=212.227.132.17; envelope-from=marcel@holtmann.org; helo=mail.holtmann.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1671564541668100001 The sign-compare warning also hits some of the for-loops, but it easy fixed by just making the iterator variable unsigned int. CC libvhost-user.o libvhost-user.c: In function =E2=80=98vu_gpa_to_va=E2=80=99: libvhost-user.c:223:19: error: comparison of integer expressions of differe= nt signedness: =E2=80=98int=E2=80=99 and =E2=80=98uint32_t=E2=80=99 {aka = =E2=80=98unsigned int=E2=80=99} [-Werror=3Dsign-compare] 223 | for (i =3D 0; i < dev->nregions; i++) { | ^ Signed-off-by: Marcel Holtmann --- subprojects/libvhost-user/libvhost-user.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvho= st-user/libvhost-user.c index bcdf32a24f60..211d31a4cc88 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -192,7 +192,7 @@ vu_panic(VuDev *dev, const char *msg, ...) void * vu_gpa_to_va(VuDev *dev, uint64_t *plen, uint64_t guest_addr) { - int i; + unsigned int i; =20 if (*plen =3D=3D 0) { return NULL; @@ -218,7 +218,7 @@ vu_gpa_to_va(VuDev *dev, uint64_t *plen, uint64_t guest= _addr) static void * qva_to_va(VuDev *dev, uint64_t qemu_addr) { - int i; + unsigned int i; =20 /* Find matching memory region. */ for (i =3D 0; i < dev->nregions; i++) { @@ -621,7 +621,7 @@ map_ring(VuDev *dev, VuVirtq *vq) =20 static bool generate_faults(VuDev *dev) { - int i; + unsigned int i; for (i =3D 0; i < dev->nregions; i++) { VuDevRegion *dev_region =3D &dev->regions[i]; int ret; @@ -829,7 +829,7 @@ static inline bool reg_equal(VuDevRegion *vudev_reg, static bool vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { VhostUserMemoryRegion m =3D vmsg->payload.memreg.region, *msg_region = =3D &m; - int i; + unsigned int i; bool found =3D false; =20 if (vmsg->fd_num > 1) { @@ -895,7 +895,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { static bool vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg) { - int i; + unsigned int i; VhostUserMemory m =3D vmsg->payload.memory, *memory =3D &m; dev->nregions =3D memory->nregions; =20 @@ -972,7 +972,7 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg= *vmsg) static bool vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg) { - int i; + unsigned int i; VhostUserMemory m =3D vmsg->payload.memory, *memory =3D &m; =20 for (i =3D 0; i < dev->nregions; i++) { @@ -1980,7 +1980,7 @@ end: void vu_deinit(VuDev *dev) { - int i; + unsigned int i; =20 for (i =3D 0; i < dev->nregions; i++) { VuDevRegion *r =3D &dev->regions[i]; --=20 2.38.1 From nobody Mon May 20 14:32:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671564585063262.09161946986967; Tue, 20 Dec 2022 11:29:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iH0-0004bn-HZ; Tue, 20 Dec 2022 14:27:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7iGz-0004a5-8G for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:33 -0500 Received: from coyote.holtmann.net ([212.227.132.17] helo=mail.holtmann.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iGx-0002Za-Bb for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:32 -0500 Received: from fedora.. (p4fefcc21.dip0.t-ipconnect.de [79.239.204.33]) by mail.holtmann.org (Postfix) with ESMTPSA id 9A831CED0F; Tue, 20 Dec 2022 20:27:26 +0100 (CET) From: Marcel Holtmann To: qemu-devel@nongnu.org, mst@redhat.com, xieyongji@bytedance.com Cc: marcel@holtmann.org Subject: [PATCH v2 05/10] libvhost-user: Declare uffdio_register early to make it C90 compliant Date: Tue, 20 Dec 2022 20:27:17 +0100 Message-Id: <13655a4dab546b6df5f2d2622f57c6063cf8b6b6.1671563795.git.marcel@holtmann.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=212.227.132.17; envelope-from=marcel@holtmann.org; helo=mail.holtmann.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1671564586500100003 When using libvhost-user source in an external project that wants to comply with the C90 standard, it is best to declare variables before code. CC libvhost-user.o libvhost-user.c: In function =E2=80=98generate_faults=E2=80=99: libvhost-user.c:683:9: error: ISO C90 forbids mixed declarations and code [= -Werror=3Ddeclaration-after-statement] 683 | struct uffdio_register reg_struct; | ^~~~~~ In this case, it is also simple enough and doesn't cause any extra ifdef additions. Signed-off-by: Marcel Holtmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- subprojects/libvhost-user/libvhost-user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvho= st-user/libvhost-user.c index 211d31a4cc88..bf92cc85c086 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -626,6 +626,8 @@ generate_faults(VuDev *dev) { VuDevRegion *dev_region =3D &dev->regions[i]; int ret; #ifdef UFFDIO_REGISTER + struct uffdio_register reg_struct; + /* * We should already have an open ufd. Mark each memory * range as ufd. @@ -659,7 +661,7 @@ generate_faults(VuDev *dev) { "%s: Failed to madvise(NOHUGEPAGE) region %d: %s\n", __func__, i, strerror(errno)); } - struct uffdio_register reg_struct; + reg_struct.range.start =3D (uintptr_t)dev_region->mmap_addr; reg_struct.range.len =3D dev_region->size + dev_region->mmap_offse= t; reg_struct.mode =3D UFFDIO_REGISTER_MODE_MISSING; --=20 2.38.1 From nobody Mon May 20 14:32:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671564564862384.67897293344765; Tue, 20 Dec 2022 11:29:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iH0-0004bo-KH; Tue, 20 Dec 2022 14:27:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7iGz-0004a2-1u for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:33 -0500 Received: from coyote.holtmann.net ([212.227.132.17] helo=mail.holtmann.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iGx-0002ZZ-BI for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:32 -0500 Received: from fedora.. (p4fefcc21.dip0.t-ipconnect.de [79.239.204.33]) by mail.holtmann.org (Postfix) with ESMTPSA id C97A4CED10; Tue, 20 Dec 2022 20:27:26 +0100 (CET) From: Marcel Holtmann To: qemu-devel@nongnu.org, mst@redhat.com, xieyongji@bytedance.com Cc: marcel@holtmann.org Subject: [PATCH v2 06/10] libvhost-user: Change dev->postcopy_ufd assignment to make it C90 compliant Date: Tue, 20 Dec 2022 20:27:18 +0100 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=212.227.132.17; envelope-from=marcel@holtmann.org; helo=mail.holtmann.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1671564565784100001 The assignment of dev->postcopy_ufd can be moved into an else clause and then the code becomes C90 compliant. CC libvhost-user.o libvhost-user.c: In function =E2=80=98vu_set_postcopy_advise=E2=80=99: libvhost-user.c:1625:5: error: ISO C90 forbids mixed declarations and code = [-Werror=3Ddeclaration-after-statement] 1625 | struct uffdio_api api_struct; | ^~~~~~ Understandable, it might be desired to avoid else clauses, but in this case it seems clear enough and frankly the dev->postcopy_ufd is only assigned once. Signed-off-by: Marcel Holtmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- subprojects/libvhost-user/libvhost-user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvho= st-user/libvhost-user.c index bf92cc85c086..b28b66cdb159 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -1599,12 +1599,13 @@ vu_set_config(VuDev *dev, VhostUserMsg *vmsg) static bool vu_set_postcopy_advise(VuDev *dev, VhostUserMsg *vmsg) { - dev->postcopy_ufd =3D -1; #ifdef UFFDIO_API struct uffdio_api api_struct; =20 dev->postcopy_ufd =3D syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK= ); vmsg->size =3D 0; +#else + dev->postcopy_ufd =3D -1; #endif =20 if (dev->postcopy_ufd =3D=3D -1) { --=20 2.38.1 From nobody Mon May 20 14:32:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671564490612642.680286320209; Tue, 20 Dec 2022 11:28:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iH1-0004c6-Fs; Tue, 20 Dec 2022 14:27:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7iGz-0004aH-B7 for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:33 -0500 Received: from coyote.holtmann.net ([212.227.132.17] helo=mail.holtmann.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iGx-0002Zg-L1 for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:33 -0500 Received: from fedora.. (p4fefcc21.dip0.t-ipconnect.de [79.239.204.33]) by mail.holtmann.org (Postfix) with ESMTPSA id 051B5CED11; Tue, 20 Dec 2022 20:27:27 +0100 (CET) From: Marcel Holtmann To: qemu-devel@nongnu.org, mst@redhat.com, xieyongji@bytedance.com Cc: marcel@holtmann.org Subject: [PATCH v2 07/10] libvhost-user: Switch to unsigned int for inuse field in struct VuVirtq Date: Tue, 20 Dec 2022 20:27:19 +0100 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=212.227.132.17; envelope-from=marcel@holtmann.org; helo=mail.holtmann.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1671564492690100003 It seems there is no need to keep the inuse field signed and end up with compiler warnings for sign-compare. CC libvhost-user.o libvhost-user.c: In function =E2=80=98vu_queue_pop=E2=80=99: libvhost-user.c:2763:19: error: comparison of integer expressions of differ= ent signedness: =E2=80=98int=E2=80=99 and =E2=80=98unsigned int=E2=80=99 [-= Werror=3Dsign-compare] 2763 | if (vq->inuse >=3D vq->vring.num) { | ^~ libvhost-user.c: In function =E2=80=98vu_queue_rewind=E2=80=99: libvhost-user.c:2808:13: error: comparison of integer expressions of differ= ent signedness: =E2=80=98unsigned int=E2=80=99 and =E2=80=98int=E2=80=99 [-= Werror=3Dsign-compare] 2808 | if (num > vq->inuse) { | ^ Instead of casting the comparison to unsigned int, just make the inuse field unsigned int in the fist place. Signed-off-by: Marcel Holtmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- subprojects/libvhost-user/libvhost-user.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/libvhost-user/libvhost-user.h b/subprojects/libvho= st-user/libvhost-user.h index aea7ec5061d5..8cda9b8f577a 100644 --- a/subprojects/libvhost-user/libvhost-user.h +++ b/subprojects/libvhost-user/libvhost-user.h @@ -343,7 +343,7 @@ typedef struct VuVirtq { /* Notification enabled? */ bool notification; =20 - int inuse; + unsigned int inuse; =20 vu_queue_handler_cb handler; =20 --=20 2.38.1 From nobody Mon May 20 14:32:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671564489905407.9911398313784; Tue, 20 Dec 2022 11:28:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iH1-0004bw-Ee; Tue, 20 Dec 2022 14:27:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7iGz-0004aI-Ba for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:33 -0500 Received: from coyote.holtmann.net ([212.227.132.17] helo=mail.holtmann.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iGx-0002Zf-Kj for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:33 -0500 Received: from fedora.. (p4fefcc21.dip0.t-ipconnect.de [79.239.204.33]) by mail.holtmann.org (Postfix) with ESMTPSA id 5DFD8CED12; Tue, 20 Dec 2022 20:27:27 +0100 (CET) From: Marcel Holtmann To: qemu-devel@nongnu.org, mst@redhat.com, xieyongji@bytedance.com Cc: marcel@holtmann.org Subject: [PATCH v2 08/10] libvduse: Provide _GNU_SOURCE when compiling outside of QEMU Date: Tue, 20 Dec 2022 20:27:20 +0100 Message-Id: <9a5749cfb693472aec7d6b0e1ed7a188aa0db94f.1671563795.git.marcel@holtmann.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=212.227.132.17; envelope-from=marcel@holtmann.org; helo=mail.holtmann.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1671564492562100001 When the libvduse sources are used by another project, it can not be guaranteed that _GNU_SOURCE is set by the build system. If it is for example not set, errors like this show up. CC libvduse.o libvduse.c: In function =E2=80=98vduse_log_get=E2=80=99: libvduse.c:172:9: error: implicit declaration of function =E2=80=98ftruncat= e=E2=80=99; did you mean =E2=80=98strncat=E2=80=99? [-Werror=3Dimplicit-fun= ction-declaration] 172 | if (ftruncate(fd, size) =3D=3D -1) { | ^~~~~~~~~ | strncat The simplest way to allow external complication of libvduse.[ch] by setting _GNU_SOURCE if it is not already set by the build system. Signed-off-by: Marcel Holtmann --- subprojects/libvduse/libvduse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvdus= e.c index e089d4d546cf..c871bd331a6b 100644 --- a/subprojects/libvduse/libvduse.c +++ b/subprojects/libvduse/libvduse.c @@ -16,6 +16,10 @@ * later. See the COPYING file in the top-level directory. */ =20 +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + #include #include #include --=20 2.38.1 From nobody Mon May 20 14:32:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671564533218526.815724555922; Tue, 20 Dec 2022 11:28:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iH2-0004cM-4D; Tue, 20 Dec 2022 14:27:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7iGz-0004bG-VI for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:33 -0500 Received: from coyote.holtmann.net ([212.227.132.17] helo=mail.holtmann.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iGy-0002aA-Fh for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:33 -0500 Received: from fedora.. (p4fefcc21.dip0.t-ipconnect.de [79.239.204.33]) by mail.holtmann.org (Postfix) with ESMTPSA id 8C443CED13; Tue, 20 Dec 2022 20:27:27 +0100 (CET) From: Marcel Holtmann To: qemu-devel@nongnu.org, mst@redhat.com, xieyongji@bytedance.com Cc: marcel@holtmann.org Subject: [PATCH v2 09/10] libvduse: Switch to unsigned int for inuse field in struct VduseVirtq Date: Tue, 20 Dec 2022 20:27:21 +0100 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=212.227.132.17; envelope-from=marcel@holtmann.org; helo=mail.holtmann.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1671564533649100001 It seems there is no need to keep the inuse field signed and end up with compiler warnings for sign-compare. CC libvduse.o libvduse.c: In function =E2=80=98vduse_queue_pop=E2=80=99: libvduse.c:789:19: error: comparison of integer expressions of different si= gnedness: =E2=80=98int=E2=80=99 and =E2=80=98unsigned int=E2=80=99 [-Werror= =3Dsign-compare] 789 | if (vq->inuse >=3D vq->vring.num) { | ^~ Instead of casting the comparison to unsigned int, just make the inuse field unsigned int in the fist place. Signed-off-by: Marcel Holtmann Reviewed-by: Xie Yongji --- subprojects/libvduse/libvduse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvdus= e.c index c871bd331a6b..338ad5e352e7 100644 --- a/subprojects/libvduse/libvduse.c +++ b/subprojects/libvduse/libvduse.c @@ -101,7 +101,7 @@ struct VduseVirtq { uint16_t signalled_used; bool signalled_used_valid; int index; - int inuse; + unsigned int inuse; bool ready; int fd; VduseDev *dev; --=20 2.38.1 From nobody Mon May 20 14:32:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671564489932700.9404426244593; Tue, 20 Dec 2022 11:28:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iHB-0004dW-Gu; Tue, 20 Dec 2022 14:27:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7iH9-0004dO-Tl for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:43 -0500 Received: from coyote.holtmann.net ([212.227.132.17] helo=mail.holtmann.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7iH8-0002aB-H6 for qemu-devel@nongnu.org; Tue, 20 Dec 2022 14:27:43 -0500 Received: from fedora.. (p4fefcc21.dip0.t-ipconnect.de [79.239.204.33]) by mail.holtmann.org (Postfix) with ESMTPSA id C09A6CED14; Tue, 20 Dec 2022 20:27:27 +0100 (CET) From: Marcel Holtmann To: qemu-devel@nongnu.org, mst@redhat.com, xieyongji@bytedance.com Cc: marcel@holtmann.org Subject: [RFC v2 10/10] libvduse: Fix assignment in vring_set_avail_event Date: Tue, 20 Dec 2022 20:27:22 +0100 Message-Id: <743f1c04347de12e7e94360eed74a8dbdcff6477.1671563795.git.marcel@holtmann.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=212.227.132.17; envelope-from=marcel@holtmann.org; helo=mail.holtmann.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1671564492698100005 CC libvduse.o libvduse.c: In function =E2=80=98vring_set_avail_event=E2=80=99: libvduse.c:603:7: error: dereferencing type-punned pointer will break stric= t-aliasing rules [-Werror=3Dstrict-aliasin] 603 | *((uint16_t *)&vq->vring.used->ring[vq->vring.num]) =3D htole16= (val); | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Marcel Holtmann --- subprojects/libvduse/libvduse.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvdus= e.c index 338ad5e352e7..51a4ba1b6878 100644 --- a/subprojects/libvduse/libvduse.c +++ b/subprojects/libvduse/libvduse.c @@ -582,7 +582,10 @@ void vduse_queue_notify(VduseVirtq *vq) =20 static inline void vring_set_avail_event(VduseVirtq *vq, uint16_t val) { - *((uint16_t *)&vq->vring.used->ring[vq->vring.num]) =3D htole16(val); + vring_used_elem_t *ring =3D &vq->vring.used->ring[vq->vring.num]; + + /* FIXME: Is this actually correct since this is __virtio32 id; */ + ring->id =3D htole16(val); } =20 static bool vduse_queue_map_single_desc(VduseVirtq *vq, unsigned int *p_nu= m_sg, --=20 2.38.1