virtio_ring: fix errors to make virtio tools

Started by Cai Huoqing on Jul 14, 2021 · 4 messages from 1 author · Last reply Jul 19, 2021

Series

2 patches, 2 files

+5 −3

Subsystems (2)

Maintainers (4)

STALE1945d

open the first message on its own page

  1. [PATCH 2/2] virtio_ring: fix error - 'prev' and 'head_flags' may be used uninitialized in this function
    Related patches
  2. [PATCH 1/2] virtio_ring: fix error - unknown type name 'spinlock_t'
    Related patches
Message details and related content
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

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

[PATCH 2/2] virtio_ring: fix error - 'prev' and 'head_flags' may be used uninitialized in this function

Message details and related content
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 <redacted>
---
 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

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

Message details and related content
when run "make virtio" in linux/tools,
the error: unknown type name 'spinlock_t' occurs

Signed-off-by: Cai Huoqing <redacted>
---
 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

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

Message details and related content
Is it a error,  try “make virtio” in the path of linux/tools/ with config VHOST_IOTLB=n

-----Original Message-----
From: Cai,Huoqing <redacted> 
Sent: 2021年7月14日 10:29
To: sgarzare@redhat.com; mst@redhat.com; <redacted>
Cc: <redacted>; <redacted>; Cai,Huoqing <redacted>
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 <redacted>
---
 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

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help