2021-07-14 02:30:20

by Cai,Huoqing

[permalink] [raw]
Subject: [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


2021-07-14 02:30:38

by Cai,Huoqing

[permalink] [raw]
Subject: [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 <[email protected]>
---
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

2021-07-14 02:30:57

by Cai,Huoqing

[permalink] [raw]
Subject: [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 <[email protected]>
---
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

2021-07-19 05:16:22

by Cai,Huoqing

[permalink] [raw]
Subject: RE: [PATCH 1/2] virtio_ring: fix error - unknown type name 'spinlock_t'

Is it a error, try ??make virtio?? in the path of linux/tools/ with config VHOST_IOTLB=n

-----Original Message-----
From: Cai,Huoqing <[email protected]>
Sent: 2021??7??14?? 10:29
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Cai,Huoqing <[email protected]>
Subject: [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 <[email protected]>
---
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