diff mbox

virtio-pci: read the right virtio_pci_notify_cap field

Message ID 1454351791-25686-1-git-send-email-lprosek@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ladi Prosek Feb. 1, 2016, 6:36 p.m. UTC
Looks like a copy-paste bug. The value is used only for one sanity
check and it probably isn't causing any damage. Found when porting
this code to Windows.

Signed-off-by: Ladi Prosek <lprosek@redhat.com>
---
 drivers/virtio/virtio_pci_modern.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael S. Tsirkin Feb. 2, 2016, 2:09 p.m. UTC | #1
On Mon, Feb 01, 2016 at 07:36:31PM +0100, Ladi Prosek wrote:
> Looks like a copy-paste bug. The value is used only for one sanity
> check and it probably isn't causing any damage. Found when porting
> this code to Windows.
> 
> Signed-off-by: Ladi Prosek <lprosek@redhat.com>

I tweaked this to say:
	The value is used as an optimization and a
	wrong value probably isn't causing any serious damage.

And applied.

Thanks!

> ---
>  drivers/virtio/virtio_pci_modern.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
> index c0c11fa..7760fc1 100644
> --- a/drivers/virtio/virtio_pci_modern.c
> +++ b/drivers/virtio/virtio_pci_modern.c
> @@ -679,7 +679,7 @@ int virtio_pci_modern_probe(struct virtio_pci_device *vp_dev)
>  
>  	pci_read_config_dword(pci_dev,
>  			      notify + offsetof(struct virtio_pci_notify_cap,
> -						cap.length),
> +						cap.offset),
>  			      &notify_offset);
>  
>  	/* We don't know how many VQs we'll map, ahead of the time.
> -- 
> 2.5.0
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
index c0c11fa..7760fc1 100644
--- a/drivers/virtio/virtio_pci_modern.c
+++ b/drivers/virtio/virtio_pci_modern.c
@@ -679,7 +679,7 @@  int virtio_pci_modern_probe(struct virtio_pci_device *vp_dev)
 
 	pci_read_config_dword(pci_dev,
 			      notify + offsetof(struct virtio_pci_notify_cap,
-						cap.length),
+						cap.offset),
 			      &notify_offset);
 
 	/* We don't know how many VQs we'll map, ahead of the time.