From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tetsuya Mukawa Subject: Re: [PATCH v6 2/2] vhost: Add VHOST PMD Date: Wed, 3 Feb 2016 18:35:40 +0900 Message-ID: <56B1C9EC.3030701@igel.co.jp> 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> <20160203092422.GA22202@sivlogin002.ir.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit To: dev@dpdk.org, yuanhan.liu@intel.com, ann.zhuangyanying@huawei.com Return-path: Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by dpdk.org (Postfix) with ESMTP id 781F22E81 for ; Wed, 3 Feb 2016 10:35:43 +0100 (CET) Received: by mail-pa0-f51.google.com with SMTP id uo6so10968750pac.1 for ; Wed, 03 Feb 2016 01:35:43 -0800 (PST) In-Reply-To: <20160203092422.GA22202@sivlogin002.ir.intel.com> 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 2016/02/03 18:24, Ferruh Yigit wrote: > 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. I've got your point. Thanks! Tetsuya