lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 29 May 2018 11:45:03 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Auger Eric <eric.auger@...hat.com>
Cc:     Alex Williamson <alex.williamson@...hat.com>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] vfio/pci: remove a bogus cast in vfio_msi_set_block()

On Mon, May 28, 2018 at 09:27:18PM +0200, Auger Eric wrote:
> 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@...cle.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.
> 

Oh, wow...  Yeah.  Sorry.  I didn't think that through.  I will create
a static checker warning so this particular bug doesn't happen to me
again.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ