From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 5CE767CDA; Sat, 3 Jun 2017 08:59:15 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 467FFB280D; Sat, 3 Jun 2017 06:59:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 467FFB280D Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=maxime.coquelin@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 467FFB280D Received: from [10.36.112.15] (unknown [10.36.112.15]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4BAED7B534; Sat, 3 Jun 2017 06:59:11 +0000 (UTC) To: Jerin Jacob , dev@dpdk.org Cc: bruce.richardson@intel.com, thomas@monjalon.net, cristian.dumitrescu@intel.com, yuanhan.liu@linux.intel.com, stable@dpdk.org References: <20170602112031.9112-1-jerin.jacob@caviumnetworks.com> <20170602112031.9112-4-jerin.jacob@caviumnetworks.com> From: Maxime Coquelin Message-ID: Date: Sat, 3 Jun 2017 08:59:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <20170602112031.9112-4-jerin.jacob@caviumnetworks.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 03 Jun 2017 06:59:14 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH 4/4] examples/vhost: fix uninitialized desc indexes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jun 2017 06:59:15 -0000 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 Reviewed-by: Maxime Coquelin > --- > 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