From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH v6 2/2] vhost: Add VHOST PMD Date: Wed, 3 Feb 2016 09:24:22 +0000 Message-ID: <20160203092422.GA22202@sivlogin002.ir.intel.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 Cc: dev@dpdk.org, ann.zhuangyanying@huawei.com, yuanhan.liu@intel.com To: Tetsuya Mukawa Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 70C892E81 for ; Wed, 3 Feb 2016 10:26:28 +0100 (CET) Content-Disposition: inline In-Reply-To: <56B1B0C1.2070500@igel.co.jp> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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