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 9EC60A04DC; Mon, 26 Oct 2020 13:33:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 023132B9D; Mon, 26 Oct 2020 13:33:16 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by dpdk.org (Postfix) with ESMTP id 3261C100C for ; Mon, 26 Oct 2020 13:33:14 +0100 (CET) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id EC2717F4F3; Mon, 26 Oct 2020 15:33:12 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru EC2717F4F3 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1603715593; bh=p81P8adJa06dqaJ1z03g41vJKH84LAhqRMINo4FEAfQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=pESPBUThrqdiVQtDTrnq9zUF0kLVIcinPa7grfz4hhTiSN7BRAd38hRSc7Ihq4hLy 2SasTngYUXbup4+ZcTeeu7sH7C8p6Jj7K+0NpCnU4LZfUpjOKTaZMR0cQF5tuNkPAl LG+zVwEBPO/vzg7Dnt23vDHJWS9rT/t7zc7ZajVY= To: Thomas Monjalon , Yunjian Wang Cc: dev@dpdk.org, ferruh.yigit@intel.com, jerry.lilijun@huawei.com, xudingke@huawei.com, matan@nvidia.com References: <2394739.RyDTFpqa36@thomas> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: <805008d1-0e44-3cae-4997-80afacb79bd6@oktetlabs.ru> Date: Mon, 26 Oct 2020 15:33:12 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <2394739.RyDTFpqa36@thomas> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] ethdev: fix data type for port id 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 10/26/20 3:29 PM, Thomas Monjalon wrote: > 26/10/2020 13:24, wangyunjian: >> From: Yunjian Wang >> >> The ethdev port id should be 16 bits now. This patch fixes the data >> type of the variable for 'pid', changing from uint32_t to uint16_t. >> >> Fixes: 5b7ba31148a8 ("ethdev: add port ownership") > > It was 32-bit on purpose, to avoid overflow in this loop: > for (pid = 0; pid < RTE_MAX_ETHPORTS; pid++) > > It is now replaced by RTE_ETH_FOREACH_VALID_DEV, > but I wonder whether we still have this theoritical overflow risk. > If yes, we should change more variables to 32-bit. Ah, it is too tricky. May be it is better to ensure that RTE_MAX_ETHPORTS is less or equal to UINT16_MAX?