From nobody Mon Feb 9 01:47:24 2026 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 1671628883437921.7457805205385; Wed, 21 Dec 2022 05:21:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7yrm-0005WT-Rq; Wed, 21 Dec 2022 08:10:38 -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 1p7yri-0005ID-ST for qemu-devel@nongnu.org; Wed, 21 Dec 2022 08:10:34 -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 1p7yrg-0005Cj-Vq for qemu-devel@nongnu.org; Wed, 21 Dec 2022 08:10:34 -0500 Received: from fedora.. (p4fefcc21.dip0.t-ipconnect.de [79.239.204.33]) by mail.holtmann.org (Postfix) with ESMTPSA id A2553CED1A; Wed, 21 Dec 2022 14:10:31 +0100 (CET) From: Marcel Holtmann To: qemu-devel@nongnu.org, mst@redhat.com, xieyongji@bytedance.com Cc: marcel@holtmann.org Subject: [PATCH v3 07/10] libvhost-user: Switch to unsigned int for inuse field in struct VuVirtq Date: Wed, 21 Dec 2022 14:10:23 +0100 Message-Id: <274beb32eacf3bc1022bb48f5902425c3e959468.1671628158.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: 1671628884510100001 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