From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 93848A00C2 for ; Tue, 29 Oct 2019 07:29:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5EA7B1BED5; Tue, 29 Oct 2019 07:29:36 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 6C98A1BEBA; Tue, 29 Oct 2019 07:29:32 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2019 23:29:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,242,1569308400"; d="scan'208";a="203480727" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by orsmga006.jf.intel.com with ESMTP; 28 Oct 2019 23:29:29 -0700 Date: Tue, 29 Oct 2019 14:25:59 +0800 From: Ye Xiaolong To: "Yang, Qiming" Cc: "Jiang, JunyuX" , "dev@dpdk.org" , Chas Williams , "stable@dpdk.org" Message-ID: <20191029062559.GH12923@intel.com> References: <20191024205551.26273-1-junyux.jiang@intel.com> <20191029030406.GC12923@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] net/bonding: fix segfault using invalid port 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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 10/29, Yang, Qiming wrote: >> -----Original Message----- >> From: Ye, Xiaolong >> Sent: Tuesday, October 29, 2019 11:04 AM >> To: Yang, Qiming >> Cc: Jiang, JunyuX ; dev@dpdk.org; Chas Williams >> ; stable@dpdk.org >> Subject: Re: [dpdk-dev] [PATCH] net/bonding: fix segfault using invalid port >> >> On 10/28, Yang, Qiming wrote: >> >Hi, Junyu >> > >> >> + dev = &rte_eth_devices[port]; >> >> + internals = dev->data->dev_private; >> >Have you build success? I think we need to add (struct bond_dev_private *) >> for force transfer >> >> dev_private is a void *, an explicit type conversion is not needed here. > >OK, I saw the original code used. >- struct bond_dev_private *internals = (struct bond_dev_private *) >- dev->data->dev_private; The original cast is redundant, there is a patchset from Stephen before to cleanup these unnecessary casts. http://patches.dpdk.org/cover/53858/ Thanks, Xiaolong > >> >> Thanks, >> Xiaolong >> > >> >> >> >> if (check_for_bonded_ethdev(dev) != 0) >> >> return -1; >> >> @@ -1689,9 +1696,14 @@ int >> >> rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port) { >> >> int retval = 0; >> >> - struct rte_eth_dev *dev = &rte_eth_devices[port]; >> >> - struct bond_dev_private *internals = (struct bond_dev_private *) >> >> - dev->data->dev_private; >> >> + struct rte_eth_dev *dev; >> >> + struct bond_dev_private *internals; >> >> + >> >> + if (valid_bonded_port_id(port) != 0) >> >> + return -EINVAL; >> >> + >> >> + dev = &rte_eth_devices[port]; >> >> + internals = dev->data->dev_private; >> >Same as before >> > >> >> >> >> if (check_for_bonded_ethdev(dev) != 0) >> >> return -1; >> >> -- >> >> 2.17.1 >> >