From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id D19012082 for ; Tue, 27 Feb 2018 09:52:01 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Feb 2018 00:51:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,400,1515484800"; d="scan'208";a="20501105" Received: from awalabdu-mobl.ger.corp.intel.com (HELO [163.33.228.165]) ([163.33.228.165]) by fmsmga007.fm.intel.com with ESMTP; 27 Feb 2018 00:51:58 -0800 To: "Ananyev, Konstantin" , "thomas@monjalon.net" Cc: "rkerur@gmail.com" , "dev@dpdk.org" References: <1519687296-2872-1-git-send-email-mohammad.abdul.awal@intel.com> <2601191342CEEE43887BDE71AB97725890578299@irsmsx105.ger.corp.intel.com> From: Mohammad Abdul Awal Message-ID: <8936b7cd-5141-addf-d3fd-1e4e1a95598b@intel.com> Date: Tue, 27 Feb 2018 08:51:54 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <2601191342CEEE43887BDE71AB97725890578299@irsmsx105.ger.corp.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH] ether: fix invalid string length in ethdev name comparison X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Feb 2018 08:52:02 -0000 On 27/02/2018 00:15, Ananyev, Konstantin wrote: > >> -----Original Message----- >> From: dev [mailto:dev-bounces@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