From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ferruh.yigit@intel.com>
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id 70C892E81
 for <dev@dpdk.org>; Wed,  3 Feb 2016 10:26:28 +0100 (CET)
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by orsmga102.jf.intel.com with ESMTP; 03 Feb 2016 01:26:24 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.22,389,1449561600"; d="scan'208";a="875906512"
Received: from irvmail001.ir.intel.com ([163.33.26.43])
 by orsmga001.jf.intel.com with ESMTP; 03 Feb 2016 01:24:24 -0800
Received: from sivlogin002.ir.intel.com (sivlogin002.ir.intel.com
 [10.237.217.37])
 by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id
 u139OMCT028315; Wed, 3 Feb 2016 09:24:22 GMT
Received: from sivlogin002.ir.intel.com (localhost [127.0.0.1])
 by sivlogin002.ir.intel.com with ESMTP id u139OM1L022780;
 Wed, 3 Feb 2016 09:24:22 GMT
Received: (from fyigit@localhost)
	by sivlogin002.ir.intel.com with œ id u139OMnq022776;
	Wed, 3 Feb 2016 09:24:22 GMT
X-Authentication-Warning: sivlogin002.ir.intel.com: fyigit set sender to
 ferruh.yigit@intel.com using -f
Date: Wed, 3 Feb 2016 09:24:22 +0000
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Tetsuya Mukawa <mukawa@igel.co.jp>
Message-ID: <20160203092422.GA22202@sivlogin002.ir.intel.com>
Mail-Followup-To: Tetsuya Mukawa <mukawa@igel.co.jp>, dev@dpdk.org,
 yuanhan.liu@intel.com, ann.zhuangyanying@huawei.com
References: <1448355603-21275-2-git-send-email-mukawa@igel.co.jp>
 <1454411922-5597-3-git-send-email-mukawa@igel.co.jp>
 <20160202234319.GA925@sivlogin002.ir.intel.com> <56B1B0C1.2070500@igel.co.jp>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <56B1B0C1.2070500@igel.co.jp>
User-Agent: Mutt/1.5.17 (2007-11-01)
Cc: dev@dpdk.org, ann.zhuangyanying@huawei.com, yuanhan.liu@intel.com
Subject: Re: [dpdk-dev] [PATCH v6 2/2] vhost: Add VHOST PMD
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 03 Feb 2016 09:26:28 -0000

On Wed, Feb 03, 2016 at 04:48:17PM +0900, Tetsuya Mukawa wrote:
> On 2016/02/03 8:43, Ferruh Yigit wrote:
> > On Tue, Feb 02, 2016 at 08:18:42PM +0900, Tetsuya Mukawa wrote:
> >> +
> >> +	/* find an ethdev entry */
> >> +	eth_dev = rte_eth_dev_allocated(name);
> >> +	if (eth_dev == NULL)
> >> +		return -ENODEV;
> >> +
> >> +	internal = eth_dev->data->dev_private;
> >> +
> >> +	rte_free(vring_states[internal->port_id]);
> >> +	vring_states[internal->port_id] = NULL;
> >> +
> >> +	pthread_mutex_lock(&internal_list_lock);
> >> +	TAILQ_REMOVE(&internals_list, internal, next);
> >> +	pthread_mutex_unlock(&internal_list_lock);
> >> +
> >> +	eth_dev_stop(eth_dev);
> >> +
> >> +	if ((internal) && (internal->dev_name))
> > if "internal" can be NULL, above internal->port_id reference will crash, if can't be NULL no need to check here.
> >
> >
> 
> Hi Ferruh,
Hi Tetsuya,

> 
> I guess if internal is NULL, "internal->dev_name" will not be accessed.
Sure.

> So it may be ok to stay above code.
> 
But I mean 8,9 lines above there is an access to internal->port_id, either internal NULL check should be before that access or removed completely.

Thanks,
ferruh