From: Auger Eric <eric.auger@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Alex Williamson <alex.williamson@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] vfio/pci: remove a bogus cast in vfio_msi_set_block()
Date: Mon, 28 May 2018 21:27:18 +0200 [thread overview]
Message-ID: <8df5c218-cc97-3dbc-e820-f8bdc710ac17@redhat.com> (raw)
In-Reply-To: <20180528074756.bgl5fxvn7foe5uhn@kili.mountain>
Hi Dan,
On 05/28/2018 09:47 AM, Dan Carpenter wrote:
> This cast is confusing... The "start" variable is an unsigned int. We
> absolutely do not want to cast it to a negative int so why is the cast
> there? It turns out, when you look at the context, it's a no-op and we
> can just remove it.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c
> index 1c46045b0e7f..2724fed62129 100644
> --- a/drivers/vfio/pci/vfio_pci_intrs.c
> +++ b/drivers/vfio/pci/vfio_pci_intrs.c
> @@ -368,7 +368,7 @@ static int vfio_msi_set_block(struct vfio_pci_device *vdev, unsigned start,
> }
>
> if (ret) {
> - for (--j; j >= (int)start; j--)
> + for (--j; j >= start; j--)
I think this was done one purpose as j can be -1 while start is an
unsigned.
See b95d9305e8cb8d432ca02da1b759fef59bc50ace
"../.., -1 being compared as unsigned doesn't produce the intended stop
condition."
If I remember correctly this led to a bug.
Thanks
Eric
> vfio_msi_set_vector_signal(vdev, j, -1, msix);
> }
>
>
next prev parent reply other threads:[~2018-05-28 19:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-28 7:47 Dan Carpenter
2018-05-28 19:27 ` Auger Eric [this message]
2018-05-29 8:45 ` Dan Carpenter
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=8df5c218-cc97-3dbc-e820-f8bdc710ac17@redhat.com \
--to=eric.auger@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®