diff options
| author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2016-03-01 07:44:53 -0500 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2016-03-02 11:08:59 -0500 |
| commit | c235082b50f6dd81436b82fd73ffbdeede4ec2e4 (patch) | |
| tree | 192e331d7ffe35adaa63755e58c00dfe727a74bf | |
| parent | 15e90f526bb4e1f9d9b3ecaa8e20bd608bd4dac7 (diff) | |
virtio/s390: size of SET_IND payload
SET_IND takes as a payload the _address_ of the indicators, meaning
that we have one of the rare cases where kmalloc(sizeof(&...)) is
actually correct. Let's clarify that with a comment.
The count for the ccw, however, was only correct because the
indicators are 64 bit. Let's use the correct value.
Reported-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
| -rw-r--r-- | drivers/s390/virtio/virtio_ccw.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c index 46b110a124b0..8688ad4c825f 100644 --- a/drivers/s390/virtio/virtio_ccw.c +++ b/drivers/s390/virtio/virtio_ccw.c | |||
| @@ -342,13 +342,14 @@ static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev, | |||
| 342 | ccw->count = sizeof(*thinint_area); | 342 | ccw->count = sizeof(*thinint_area); |
| 343 | ccw->cda = (__u32)(unsigned long) thinint_area; | 343 | ccw->cda = (__u32)(unsigned long) thinint_area; |
| 344 | } else { | 344 | } else { |
| 345 | /* payload is the address of the indicators */ | ||
| 345 | indicatorp = kmalloc(sizeof(&vcdev->indicators), | 346 | indicatorp = kmalloc(sizeof(&vcdev->indicators), |
| 346 | GFP_DMA | GFP_KERNEL); | 347 | GFP_DMA | GFP_KERNEL); |
| 347 | if (!indicatorp) | 348 | if (!indicatorp) |
| 348 | return; | 349 | return; |
| 349 | *indicatorp = 0; | 350 | *indicatorp = 0; |
| 350 | ccw->cmd_code = CCW_CMD_SET_IND; | 351 | ccw->cmd_code = CCW_CMD_SET_IND; |
| 351 | ccw->count = sizeof(vcdev->indicators); | 352 | ccw->count = sizeof(&vcdev->indicators); |
| 352 | ccw->cda = (__u32)(unsigned long) indicatorp; | 353 | ccw->cda = (__u32)(unsigned long) indicatorp; |
| 353 | } | 354 | } |
| 354 | /* Deregister indicators from host. */ | 355 | /* Deregister indicators from host. */ |
| @@ -656,7 +657,10 @@ static int virtio_ccw_find_vqs(struct virtio_device *vdev, unsigned nvqs, | |||
| 656 | } | 657 | } |
| 657 | } | 658 | } |
| 658 | ret = -ENOMEM; | 659 | ret = -ENOMEM; |
| 659 | /* We need a data area under 2G to communicate. */ | 660 | /* |
| 661 | * We need a data area under 2G to communicate. Our payload is | ||
| 662 | * the address of the indicators. | ||
| 663 | */ | ||
| 660 | indicatorp = kmalloc(sizeof(&vcdev->indicators), GFP_DMA | GFP_KERNEL); | 664 | indicatorp = kmalloc(sizeof(&vcdev->indicators), GFP_DMA | GFP_KERNEL); |
| 661 | if (!indicatorp) | 665 | if (!indicatorp) |
| 662 | goto out; | 666 | goto out; |
| @@ -672,7 +676,7 @@ static int virtio_ccw_find_vqs(struct virtio_device *vdev, unsigned nvqs, | |||
| 672 | vcdev->indicators = 0; | 676 | vcdev->indicators = 0; |
| 673 | ccw->cmd_code = CCW_CMD_SET_IND; | 677 | ccw->cmd_code = CCW_CMD_SET_IND; |
| 674 | ccw->flags = 0; | 678 | ccw->flags = 0; |
| 675 | ccw->count = sizeof(vcdev->indicators); | 679 | ccw->count = sizeof(&vcdev->indicators); |
| 676 | ccw->cda = (__u32)(unsigned long) indicatorp; | 680 | ccw->cda = (__u32)(unsigned long) indicatorp; |
| 677 | ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_SET_IND); | 681 | ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_SET_IND); |
| 678 | if (ret) | 682 | if (ret) |
| @@ -683,7 +687,7 @@ static int virtio_ccw_find_vqs(struct virtio_device *vdev, unsigned nvqs, | |||
| 683 | vcdev->indicators2 = 0; | 687 | vcdev->indicators2 = 0; |
| 684 | ccw->cmd_code = CCW_CMD_SET_CONF_IND; | 688 | ccw->cmd_code = CCW_CMD_SET_CONF_IND; |
| 685 | ccw->flags = 0; | 689 | ccw->flags = 0; |
| 686 | ccw->count = sizeof(vcdev->indicators2); | 690 | ccw->count = sizeof(&vcdev->indicators2); |
| 687 | ccw->cda = (__u32)(unsigned long) indicatorp; | 691 | ccw->cda = (__u32)(unsigned long) indicatorp; |
| 688 | ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_SET_CONF_IND); | 692 | ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_SET_CONF_IND); |
| 689 | if (ret) | 693 | if (ret) |
