[dpdk-dev] [PATCH v6 2/2] vhost: Add VHOST PMD
Ferruh Yigit
ferruh.yigit at intel.com
Wed Feb 3 10:24:22 CET 2016
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
More information about the dev
mailing list