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 DECE514E8; Thu, 14 Dec 2017 15:49:36 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41CECC070155; Thu, 14 Dec 2017 14:49:36 +0000 (UTC) Received: from [10.36.112.54] (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8796817CDB; Thu, 14 Dec 2017 14:49:34 +0000 (UTC) To: Olivier Matz , dev@dpdk.org, Yuanhan Liu Cc: Didier Pallard , stable@dpdk.org References: <20171214143343.28785-1-olivier.matz@6wind.com> From: Maxime Coquelin Message-ID: Date: Thu, 14 Dec 2017 15:49:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20171214143343.28785-1-olivier.matz@6wind.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 14 Dec 2017 14:49:36 +0000 (UTC) Subject: Re: [dpdk-stable] [PATCH] net/virtio: fix incorrect cast of void * X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Dec 2017 14:49:37 -0000 On 12/14/2017 03:33 PM, Olivier Matz wrote: > From: Didier Pallard > > The rx_queues and tx_queues fields of the data structure points to a struct > virtnet_rx or virtnet_tx. Casting it to a virtqueue is an error. > > It does not trigger any bug because pointer is not dereferenced inside the > function, but it can become a bug if this code is copy/pasted and vq is > dereferenced. > > Fixes: 01ad44fd374f ("net/virtio: split Rx/Tx queue") > Cc: stable@dpdk.org > > Signed-off-by: Didier Pallard > Signed-off-by: Olivier Matz > --- > drivers/net/virtio/virtio_ethdev.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > index c0ba83b06..b398f9960 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -893,7 +893,7 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev, > /* Note: limit checked in rte_eth_xstats_names() */ > > for (i = 0; i < dev->data->nb_rx_queues; i++) { > - struct virtqueue *rxvq = dev->data->rx_queues[i]; > + struct virtnet_rx *rxvq = dev->data->rx_queues[i]; > if (rxvq == NULL) > continue; > for (t = 0; t < VIRTIO_NB_RXQ_XSTATS; t++) { > @@ -906,7 +906,7 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev, > } > > for (i = 0; i < dev->data->nb_tx_queues; i++) { > - struct virtqueue *txvq = dev->data->tx_queues[i]; > + struct virtnet_tx *txvq = dev->data->tx_queues[i]; > if (txvq == NULL) > continue; > for (t = 0; t < VIRTIO_NB_TXQ_XSTATS; t++) { > Reviewed-by: Maxime Coquelin Thanks, Maxime