Cai Huoqing
2021-Jul-14 02:28 UTC
[PATCH 0/2] virtio_ring: fix errors to make virtio tools
the errors occurs when run "make virtio" in linux/tools Cai Huoqing (2): virtio_ring: fix error - unknown type name 'spinlock_t' virtio_ring: fix error - 'prev' and 'head_flags' may be used uninitialized in this function drivers/virtio/virtio_ring.c | 6 +++--- include/linux/vringh.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) -- 2.25.1
Cai Huoqing
2021-Jul-14 02:28 UTC
[PATCH 1/2] virtio_ring: fix error - unknown type name 'spinlock_t'
when run "make virtio" in linux/tools, the error: unknown type name 'spinlock_t' occurs Signed-off-by: Cai Huoqing <caihuoqing at baidu.com> --- include/linux/vringh.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/vringh.h b/include/linux/vringh.h index 84db7b8f912f..ff21c2643792 100644 --- a/include/linux/vringh.h +++ b/include/linux/vringh.h @@ -43,11 +43,13 @@ struct vringh { /* The vring (note: it may contain user pointers!) */ struct vring vring; +#if IS_REACHABLE(CONFIG_VHOST_IOTLB) /* IOTLB for this vring */ struct vhost_iotlb *iotlb; /* spinlock to synchronize IOTLB accesses */ spinlock_t *iotlb_lock; +#endif /* The function to call to notify the guest about added buffers */ void (*notify)(struct vringh *); -- 2.25.1
Cai Huoqing
2021-Jul-14 02:28 UTC
[PATCH 2/2] virtio_ring: fix error - 'prev' and 'head_flags' may be used uninitialized in this function
when run "make virtio" in linux/tools, the error: "'prev' and 'head_flags' may be used uninitialized in this function" occurs Signed-off-by: Cai Huoqing <caihuoqing at baidu.com> --- drivers/virtio/virtio_ring.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 89bfe46a8a7f..290bdf8a3d36 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -486,7 +486,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, struct vring_virtqueue *vq = to_vvq(_vq); struct scatterlist *sg; struct vring_desc *desc; - unsigned int i, n, avail, descs_used, prev, err_idx; + unsigned int i, n, avail, descs_used, prev = 0, err_idx; int head; bool indirect; @@ -1173,8 +1173,8 @@ static inline int virtqueue_add_packed(struct virtqueue *_vq, struct vring_packed_desc *desc; struct scatterlist *sg; unsigned int i, n, c, descs_used, err_idx; - __le16 head_flags, flags; - u16 head, id, prev, curr, avail_used_flags; + __le16 head_flags = 0, flags; + u16 head, id, prev = 0, curr, avail_used_flags; START_USE(vq); -- 2.25.1