* [dpdk-stable] [dpdk-dev] [PATCH 4/4] examples/vhost: fix uninitialized desc indexes
[not found] <20170602112031.9112-1-jerin.jacob@caviumnetworks.com>
@ 2017-06-02 11:20 ` Jerin Jacob
2017-06-03 6:59 ` Maxime Coquelin
0 siblings, 1 reply; 2+ messages in thread
From: Jerin Jacob @ 2017-06-02 11:20 UTC (permalink / raw)
To: dev
Cc: bruce.richardson, thomas, cristian.dumitrescu, yuanhan.liu,
maxime.coquelin, Jerin Jacob, stable
Fixing the below error by returning from the function early
when count == 0.
Issue flagged by GCC 7.1.1
examples/vhost/virtio_net.c:370:38: error: ‘desc_indexes[0]’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
rte_prefetch0(&vr->desc[desc_indexes[0]]);
Fixes: ca059fa5e290 ("examples/vhost: demonstrate the new generic APIs")
Cc: stable@dpdk.org
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
examples/vhost/virtio_net.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/examples/vhost/virtio_net.c b/examples/vhost/virtio_net.c
index cc2c3d882..5e1ed44a5 100644
--- a/examples/vhost/virtio_net.c
+++ b/examples/vhost/virtio_net.c
@@ -350,6 +350,9 @@ vs_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id,
count = RTE_MIN(count, MAX_PKT_BURST);
count = RTE_MIN(count, free_entries);
+ if (unlikely(count == 0))
+ return 0;
+
/*
* Retrieve all of the head indexes first and pre-update used entries
* to avoid caching issues.
@@ -385,8 +388,6 @@ vs_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id,
}
}
- if (!i)
- return 0;
queue->last_avail_idx += i;
queue->last_used_idx += i;
--
2.13.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH 4/4] examples/vhost: fix uninitialized desc indexes
2017-06-02 11:20 ` [dpdk-stable] [dpdk-dev] [PATCH 4/4] examples/vhost: fix uninitialized desc indexes Jerin Jacob
@ 2017-06-03 6:59 ` Maxime Coquelin
0 siblings, 0 replies; 2+ messages in thread
From: Maxime Coquelin @ 2017-06-03 6:59 UTC (permalink / raw)
To: Jerin Jacob, dev
Cc: bruce.richardson, thomas, cristian.dumitrescu, yuanhan.liu, stable
On 06/02/2017 01:20 PM, Jerin Jacob wrote:
> Fixing the below error by returning from the function early
> when count == 0.
>
> Issue flagged by GCC 7.1.1
>
> examples/vhost/virtio_net.c:370:38: error: ‘desc_indexes[0]’ may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
> rte_prefetch0(&vr->desc[desc_indexes[0]]);
>
> Fixes: ca059fa5e290 ("examples/vhost: demonstrate the new generic APIs")
>
> Cc: stable@dpdk.org
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> examples/vhost/virtio_net.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/examples/vhost/virtio_net.c b/examples/vhost/virtio_net.c
> index cc2c3d882..5e1ed44a5 100644
> --- a/examples/vhost/virtio_net.c
> +++ b/examples/vhost/virtio_net.c
> @@ -350,6 +350,9 @@ vs_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id,
> count = RTE_MIN(count, MAX_PKT_BURST);
> count = RTE_MIN(count, free_entries);
>
> + if (unlikely(count == 0))
> + return 0;
> +
> /*
> * Retrieve all of the head indexes first and pre-update used entries
> * to avoid caching issues.
> @@ -385,8 +388,6 @@ vs_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id,
> }
>
> }
> - if (!i)
> - return 0;
>
> queue->last_avail_idx += i;
> queue->last_used_idx += i;
>
Thanks,
Maxime
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-03 6:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20170602112031.9112-1-jerin.jacob@caviumnetworks.com>
2017-06-02 11:20 ` [dpdk-stable] [dpdk-dev] [PATCH 4/4] examples/vhost: fix uninitialized desc indexes Jerin Jacob
2017-06-03 6:59 ` Maxime Coquelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).