[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 12/19] virtio: use unsigned int for virtqueue_get_ava
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 12/19] virtio: use unsigned int for virtqueue_get_avail_bytes() index |
Date: |
Fri, 23 Sep 2016 22:57:30 +0300 |
From: Stefan Hajnoczi <address@hidden>
The virtio code uses int, unsigned int, and uint16_t for virtqueue
indices. The uint16_t is used for the low-level descriptor layout in
virtio_ring.h while code that isn't concerned with descriptor layout can
use unsigned int.
Use of int is problematic because it can result in signed/unsigned
comparison and incompatible int*/unsigned int* pointer types.
Make the virtqueue_get_avail_bytes() 'i' variable unsigned int. This
eliminates the need to introduce casts and modify code further in the
patches that follow.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
---
hw/virtio/virtio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 10c2f3d..973d0c2 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -416,7 +416,7 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int
*in_bytes,
unsigned int max, num_bufs, indirect = 0;
VRingDesc desc;
hwaddr desc_pa;
- int i;
+ unsigned int i;
max = vq->vring.num;
num_bufs = total_bufs;
--
MST
- [Qemu-devel] [PULL 01/19] tests: add /vhost-user/connect-fail test, (continued)
- [Qemu-devel] [PULL 01/19] tests: add /vhost-user/connect-fail test, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 02/19] tests: add a simple /vhost-user/multiqueue test, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 03/19] tests: add /vhost-user/flags-mismatch test, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 04/19] virtio: add check for descriptor's mapped address, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 05/19] pc: clean up COMPAT macro chaining, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 06/19] target-i386: turn off CPU.l3-cache only for 2.7 and older machine types, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 09/19] virtio: migrate vdev->broken flag, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 07/19] virtio: fix stray tab character, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 08/19] virtio: stop virtqueue processing if device is broken, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 10/19] virtio: handle virtqueue_map_desc() errors, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 12/19] virtio: use unsigned int for virtqueue_get_avail_bytes() index,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 11/19] virtio: handle virtqueue_get_avail_bytes() errors, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 14/19] virtio: handle virtqueue_num_heads() errors, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 15/19] virtio: handle virtqueue_get_head() errors, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 13/19] virtio: handle virtqueue_read_next_desc() errors, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 16/19] hw/pci: Prepare for AMD IOMMU, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 17/19] hw/i386/trace-events: Add AMD IOMMU trace events, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 19/19] hw/i386: AMD IOMMU IVRS table, Michael S. Tsirkin, 2016/09/23
- [Qemu-devel] [PULL 18/19] hw/i386: Introduce AMD IOMMU, Michael S. Tsirkin, 2016/09/23
- Re: [Qemu-devel] [PULL 00/19] virtio, pc: fixes and features, no-reply, 2016/09/23