public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch 1/3] vfio: signedness bug in vfio_config_do_rw()
Date: Thu, 28 Jun 2012 08:05:00 +0000	[thread overview]
Message-ID: <20120628080500.GK5333@mwanda> (raw)
In-Reply-To: <20120628064425.GA11107@elgon.mountain>

On Thu, Jun 28, 2012 at 09:15:12AM +0200, walter harms wrote:
> 
> 
> Am 28.06.2012 08:44, schrieb Dan Carpenter:
> > The "count" variable is unsigned here so the test for errors doesn't
> > work.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
> > index a4f7321..10bc6a8 100644
> > --- a/drivers/vfio/pci/vfio_pci_config.c
> > +++ b/drivers/vfio/pci/vfio_pci_config.c
> > @@ -1487,7 +1487,7 @@ static ssize_t vfio_config_do_rw(struct vfio_pci_device *vdev, char __user *buf,
> >  		if (perm->readfn) {
> >  			count = perm->readfn(vdev, *ppos, count,
> >  					     perm, offset, &val);
> > -			if (count < 0)
> > +			if ((ssize_t)count < 0)
> >  				return count;
> >  		}
> >  
> 
> hi,
> I can only find a few references to vfio_config_do_rw(). From the
> patchit seems to me this is a wrapper for perm->readfn since both
> return ssize_t so why i count unsigned in the first place ?

Yeah.  You're right.  That was stupid of me.  I'll resend.

regards,
dan carpenter


  parent reply	other threads:[~2012-06-28  8:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1340686552.1207.128.camel@bling.home>
2012-06-28  6:44 ` [patch 1/3] vfio: signedness bug in vfio_config_do_rw() Dan Carpenter
2012-06-28  7:15   ` walter harms
2012-06-28  8:07     ` [patch 1/3 v2] " Dan Carpenter
2012-06-28 22:24       ` Alex Williamson
2012-06-28  8:05   ` Dan Carpenter [this message]
2012-06-28  6:44 ` [patch 2/3] vfio: make count unsigned to prevent integer underflow Dan Carpenter
2012-06-28 22:24   ` Alex Williamson
2012-06-28  6:45 ` [patch 3/3] vfio: return -EFAULT on failure Dan Carpenter
2012-06-28 22:25   ` Alex Williamson

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=20120628080500.GK5333@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@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