* [patch 1/3 v2] vfio: signedness bug in vfio_config_do_rw() [not found] <4FEC0480.7010508@bfs.de> @ 2012-06-28 8:07 ` Dan Carpenter 2012-06-28 22:24 ` Alex Williamson 0 siblings, 1 reply; 2+ messages in thread From: Dan Carpenter @ 2012-06-28 8:07 UTC (permalink / raw) To: Alex Williamson; +Cc: kvm, linux-kernel, kernel-janitors, walter harms The "count" variable needs to be signed here because we use it to store negative error codes. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> --- v2: Just declare count as signed. diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c index a4f7321..2e00aa8 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_config.c @@ -1419,7 +1419,7 @@ void vfio_config_free(struct vfio_pci_device *vdev) } static ssize_t vfio_config_do_rw(struct vfio_pci_device *vdev, char __user *buf, - size_t count, loff_t *ppos, bool iswrite) + ssize_t count, loff_t *ppos, bool iswrite) { struct pci_dev *pdev = vdev->pdev; struct perm_bits *perm; ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch 1/3 v2] vfio: signedness bug in vfio_config_do_rw() 2012-06-28 8:07 ` [patch 1/3 v2] vfio: signedness bug in vfio_config_do_rw() Dan Carpenter @ 2012-06-28 22:24 ` Alex Williamson 0 siblings, 0 replies; 2+ messages in thread From: Alex Williamson @ 2012-06-28 22:24 UTC (permalink / raw) To: Dan Carpenter; +Cc: kvm, linux-kernel, kernel-janitors, walter harms On Thu, 2012-06-28 at 11:07 +0300, Dan Carpenter wrote: > The "count" variable needs to be signed here because we use it to store > negative error codes. > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > --- > v2: Just declare count as signed. > > diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c > index a4f7321..2e00aa8 100644 > --- a/drivers/vfio/pci/vfio_pci_config.c > +++ b/drivers/vfio/pci/vfio_pci_config.c > @@ -1419,7 +1419,7 @@ void vfio_config_free(struct vfio_pci_device *vdev) > } > > static ssize_t vfio_config_do_rw(struct vfio_pci_device *vdev, char __user *buf, > - size_t count, loff_t *ppos, bool iswrite) > + ssize_t count, loff_t *ppos, bool iswrite) > { > struct pci_dev *pdev = vdev->pdev; > struct perm_bits *perm; signed doesn't seem right for count since just below this chunk we do: if (*ppos < 0 || *ppos + count > pdev->cfg_size) return -EFAULT; So then we have to start testing for negative count. I've added a ssize_t variable for return that should clear things up. Thanks for the report! Alex ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-28 22:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4FEC0480.7010508@bfs.de>
2012-06-28 8:07 ` [patch 1/3 v2] vfio: signedness bug in vfio_config_do_rw() Dan Carpenter
2012-06-28 22:24 ` Alex Williamson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox