From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 83C971B293; Wed, 27 Dec 2017 15:38:48 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 0CAC820D46; Wed, 27 Dec 2017 09:38:48 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 27 Dec 2017 09:38:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=2ROwNeU0Q9ea5LppNQEQl+G6txJifKzpGabzntivRYw=; b=ohM//QiH N8eeLUYvr9jaj/F3VAjmOfAfO3uT3IoPSk60HCMsC8C3kjdYmZj+wL0cfnCtpiHc d2yMvInd0h153Bb6SXXvwTvUdhhZqjp1FrfK4/1vJOaSEh4xVb0AR6JInoPvvlVg JhwvfsxJqTuW1H3FX8rOFB8bqFywtXl+72RKJKcvBN9VTronlLz0rHtasccbrfD4 ZzTejsjoclxnAUF1okmXD0/SZaz991QAZgolXYI3PEz7fvphQwBUsqccvAfRLurf PIsxOAJI7Tr/VJVKgK7hYDVMNUMi1JyMkGjHd4ve/1qY9WZa7TwkCJ6vG0e55Ufg n1JLny0aPrXpIg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=2ROwNeU0Q9ea5LppNQEQl+G6txJif KzpGabzntivRYw=; b=jnAFwmIS2WUtUmCn59d9Ifc7gtFHutiIv/PYmWMt+31sQ CHLSUMH1Nauicm3R6X36CeeDCdHa1vZsTZXUvkZJxpSFCWZ8cVY86rHglx879+wf 9xUwrSZJtHgwVzZ7SsdINK7hyIn/lT5mCGhiEHIOgo7gCntjhNhDieCL7c9jqbJR r6tJfbLATEK79aO6F0/A/94KYqK7C4t7jBx1/ETzECxRoMFaPG+Uv3cqRlayyIUl 166z6eWhRtggGHlMHBshbLG4NU44EZSjFgBJuENF8D3AaXMjdf3bbKdZu3o0O00y qLUnY2CVKLDS4DwpT1K92bj99gimT0MWCJVvB4QpA== X-ME-Sender: Received: from yliu-mob (unknown [115.150.27.225]) by mail.messagingengine.com (Postfix) with ESMTPA id 9EE617E263; Wed, 27 Dec 2017 09:38:46 -0500 (EST) Date: Wed, 27 Dec 2017 22:38:42 +0800 From: Yuanhan Liu To: Maxime Coquelin Cc: Olivier Matz , dev@dpdk.org, Didier Pallard , stable@dpdk.org Message-ID: <20171227143842.GI8818@yliu-mob> References: <20171214143343.28785-1-olivier.matz@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) 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: Wed, 27 Dec 2017 14:38:48 -0000 On Thu, Dec 14, 2017 at 03:49:32PM +0100, Maxime Coquelin wrote: > > > 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 Applied to dpdk-next-virtio. Thanks. --yliu