All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	wangyunjian <wangyunjian@huawei.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
	"Lilijun (Jerry)" <jerry.lilijun@huawei.com>,
	xudingke <xudingke@huawei.com>,
	"matan@nvidia.com" <matan@nvidia.com>
Subject: Re: [dpdk-dev] [PATCH] ethdev: fix data type for port id
Date: Tue, 27 Oct 2020 09:47:46 +0100	[thread overview]
Message-ID: <2875306.mtlTzNjAsc@thomas> (raw)
In-Reply-To: <34EFBCA9F01B0748BEB6B629CE643AE60DAD8144@DGGEMM533-MBX.china.huawei.com>

27/10/2020 03:46, wangyunjian:
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > 26/10/2020 13:33, Andrew Rybchenko:
> > > On 10/26/20 3:29 PM, Thomas Monjalon wrote:
> > > > 26/10/2020 13:24, wangyunjian:
> > > >> From: Yunjian Wang <wangyunjian@huawei.com>
> > > >>
> > > >> 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?
> > 
> > Yes could be another option.
> > 
> 
> Add a check on RTE_MAX_ETHPORT in rte_eal_init()?

Could be a compilation check done with RTE_BUILD_BUG_ON.



  reply	other threads:[~2020-10-27  8:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26 12:24 [dpdk-dev] [PATCH] ethdev: fix data type for port id wangyunjian
2020-10-26 12:29 ` Thomas Monjalon
2020-10-26 12:33   ` Andrew Rybchenko
2020-10-26 12:34     ` Thomas Monjalon
2020-10-27  2:46       ` wangyunjian
2020-10-27  8:47         ` Thomas Monjalon [this message]
2020-10-26 12:29 ` Andrew Rybchenko
2020-10-27 13:41 ` [dpdk-dev] [PATCH v2] " wangyunjian
2020-10-27 14:29   ` Thomas Monjalon
2020-10-29 12:18     ` wangyunjian
2020-10-29 12:40       ` Andrew Rybchenko
2020-10-29 12:43       ` Thomas Monjalon
2020-11-02  9:18   ` [dpdk-dev] [PATCH v3] " wangyunjian
2020-11-03 18:44     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2020-11-03 23:42       ` Stephen Hemminger
2020-11-04  1:57       ` wangyunjian
2020-11-04  2:57     ` [dpdk-dev] [PATCH v4] " wangyunjian
2020-11-04  3:26       ` Ajit Khaparde
2020-11-04 11:46         ` Ferruh Yigit
2020-11-04 13:49           ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2875306.mtlTzNjAsc@thomas \
    --to=thomas@monjalon.net \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jerry.lilijun@huawei.com \
    --cc=matan@nvidia.com \
    --cc=wangyunjian@huawei.com \
    --cc=xudingke@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.