[dpdk-stable] [dpdk-dev] [PATCH] net/bonding: fix segfault using invalid port
Ye Xiaolong
xiaolong.ye at intel.com
Tue Oct 29 07:25:59 CET 2019
On 10/29, Yang, Qiming wrote:
>> -----Original Message-----
>> From: Ye, Xiaolong
>> Sent: Tuesday, October 29, 2019 11:04 AM
>> To: Yang, Qiming <qiming.yang at intel.com>
>> Cc: Jiang, JunyuX <junyux.jiang at intel.com>; dev at dpdk.org; Chas Williams
>> <chas3 at att.com>; stable at 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
>> >
More information about the stable
mailing list