qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: qemu-devel@nongnu.org, mst@redhat.com, xieyongji@bytedance.com,
	pbonzini@redhat.com
Cc: marcel@holtmann.org
Subject: [PATCH v4 08/12] libvduse: Switch to unsigned int for inuse field in struct VduseVirtq
Date: Thu, 22 Dec 2022 21:36:47 +0100	[thread overview]
Message-ID: <9fe3fd8b042e048bd04d506ca6e43d738b5c45b7.1671741278.git.marcel@holtmann.org> (raw)
In-Reply-To: <cover.1671741278.git.marcel@holtmann.org>

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 ‘vduse_queue_pop’:
libvduse.c:789:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Werror=sign-compare]
  789 |     if (vq->inuse >= 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 <marcel@holtmann.org>
Reviewed-by: Xie Yongji <xieyongji@bytedance.com>
---
 subprojects/libvduse/libvduse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvduse.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;
-- 
2.38.1



  parent reply	other threads:[~2022-12-22 20:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22 20:36 [PATCH v4 00/12] Compiler warning fixes for libvhost-user,libvduse Marcel Holtmann
2022-12-22 20:36 ` [PATCH v4 01/12] libvhost-user: Provide _GNU_SOURCE when compiling outside of QEMU Marcel Holtmann
2022-12-22 20:36 ` [PATCH v4 02/12] libvhost-user: Replace typeof with __typeof__ Marcel Holtmann
2022-12-22 20:36 ` [PATCH v4 03/12] libvhost-user: Cast rc variable to avoid compiler warning Marcel Holtmann
2022-12-22 20:36 ` [PATCH v4 04/12] libvhost-user: Use unsigned int i for some for-loop iterations Marcel Holtmann
2022-12-22 20:36 ` [PATCH v4 05/12] libvhost-user: Declare uffdio_register early to make it C90 compliant Marcel Holtmann
2022-12-22 20:36 ` [PATCH v4 06/12] libvhost-user: Change dev->postcopy_ufd assignment " Marcel Holtmann
2022-12-22 20:36 ` [PATCH v4 07/12] libvduse: Provide _GNU_SOURCE when compiling outside of QEMU Marcel Holtmann
2022-12-22 20:36 ` Marcel Holtmann [this message]
2022-12-22 20:36 ` [PATCH v4 09/12] libvduse: Fix assignment in vring_set_avail_event Marcel Holtmann
2022-12-22 20:36 ` [PATCH v4 10/12] libvhost-user: " Marcel Holtmann
2022-12-22 20:36 ` [PATCH v4 11/12] libvhost-user: Add extra compiler warnings Marcel Holtmann
2022-12-22 20:36 ` [PATCH v4 12/12] libvduse: " Marcel Holtmann
2022-12-23 15:21 ` [PATCH v4 00/12] Compiler warning fixes for libvhost-user,libvduse Paolo Bonzini
2022-12-23 15:28   ` Marcel Holtmann
2022-12-23 17:55   ` Michael S. Tsirkin
2023-01-05  1:58 ` Michael S. Tsirkin
2023-01-10  9:54   ` [PATCH v4 00/12] Compiler warning fixes for libvhost-user, libvduse Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9fe3fd8b042e048bd04d506ca6e43d738b5c45b7.1671741278.git.marcel@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xieyongji@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).