[dpdk-dev] [PATCH] ether: fix invalid string length in ethdev name comparison

Mohammad Abdul Awal mohammad.abdul.awal at intel.com
Tue Feb 27 09:51:54 CET 2018



On 27/02/2018 00:15, Ananyev, Konstantin wrote:
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Mohammad Abdul Awal
>>
>> +	len1 = strlen(name);
>>   	for (pid = 0; pid < RTE_MAX_ETHPORTS; pid++) {
>> +		len2 = strlen(rte_eth_dev_shared_data->data[pid].name);
>> +		len = len1 > len2 ? len1 : len2;
>>   		if (rte_eth_devices[pid].state != RTE_ETH_DEV_UNUSED &&
>>   		    !strncmp(name, rte_eth_dev_shared_data->data[pid].name,
>> -			     strlen(name))) {
>> +			     len)) {
> Why just not simply use strcmp()? :)
That is the best I would say. I will submit a V2.

>
>>   			*port_id = pid;
>>   			return 0;
>>   		}
>> --
>> 2.7.4



More information about the dev mailing list