From: "Michael S. Tsirkin" <mst@redhat.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 7/7] libvhost-user: Switch to unsigned int for inuse field in struct VuVirtq
Date: Tue, 20 Dec 2022 10:15:40 -0500 [thread overview]
Message-ID: <20221220101454-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20221219175337.377435-8-marcel@holtmann.org>
On Mon, Dec 19, 2022 at 06:53:37PM +0100, Marcel Holtmann wrote:
> 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 ‘vu_queue_pop’:
> libvhost-user.c:2763:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Werror=sign-compare]
> 2763 | if (vq->inuse >= vq->vring.num) {
> | ^~
> libvhost-user.c: In function ‘vu_queue_rewind’:
> libvhost-user.c:2808:13: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare]
> 2808 | if (num > vq->inuse) {
> | ^
>
> Instead of casting the comparision to unsigned int, just make the inuse
> field unsigned int in the fist place.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Is this a part of a patchset? No threading visible and I'd rather not
guess.
> ---
> 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/libvhost-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;
>
> - int inuse;
> + unsigned int inuse;
>
> vu_queue_handler_cb handler;
>
> --
> 2.38.1
>
>
>
next prev parent reply other threads:[~2022-12-20 15:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-19 17:53 [PATCH 7/7] libvhost-user: Switch to unsigned int for inuse field in struct VuVirtq Marcel Holtmann
2022-12-19 18:37 ` Philippe Mathieu-Daudé
2022-12-19 18:58 ` Marcel Holtmann
2022-12-20 15:15 ` Michael S. Tsirkin [this message]
2022-12-20 19:04 ` Marcel Holtmann
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=20221220101454-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=marcel@holtmann.org \
--cc=qemu-devel@nongnu.org \
/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).