From: Jakub Kicinski <kuba@kernel.org>
To: Leon Romanovsky <leon@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
pabeni@redhat.com, sd@queasysnail.net
Subject: Re: [PATCH net-next v2 1/2] net: store netdevs in an xarray
Date: Thu, 27 Jul 2023 08:45:19 -0700 [thread overview]
Message-ID: <20230727084519.7ec951dd@kernel.org> (raw)
In-Reply-To: <20230727130824.GA2652767@unreal>
On Thu, 27 Jul 2023 16:08:24 +0300 Leon Romanovsky wrote:
> > + if (!ifindex)
> > + err = xa_alloc_cyclic(&net->dev_by_index, &ifindex, NULL,
> > + xa_limit_31b, &net->ifindex, GFP_KERNEL);
> > + else
> > + err = xa_insert(&net->dev_by_index, ifindex, NULL, GFP_KERNEL);
> > + if (err < 0)
> > + return err;
> > +
> > + return ifindex;
>
> ifindex is now u32, but you return it as int. In potential, you can
> return valid ifindex which will be treated as error.
>
> You should ensure that ifindex doesn't have signed bit on.
I'm feeding xa_alloc_cyclic() xa_limit_31b, which should take care
of that, no?
next prev parent reply other threads:[~2023-07-27 15:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-26 18:55 [PATCH net-next v2 0/2] net: store netdevs in an xarray Jakub Kicinski
2023-07-26 18:55 ` [PATCH net-next v2 1/2] " Jakub Kicinski
2023-07-27 13:08 ` Leon Romanovsky
2023-07-27 15:45 ` Jakub Kicinski [this message]
2023-07-28 4:53 ` Leon Romanovsky
2023-07-28 15:27 ` Jakub Kicinski
2023-07-28 23:23 ` Stephen Hemminger
2023-07-29 0:07 ` Jakub Kicinski
2023-07-26 18:55 ` [PATCH net-next v2 2/2] net: convert some netlink netdev iterators to depend on the xarray Jakub Kicinski
2023-07-27 13:10 ` Leon Romanovsky
2023-07-28 19:00 ` [PATCH net-next v2 0/2] net: store netdevs in an xarray patchwork-bot+netdevbpf
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=20230727084519.7ec951dd@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=leon@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sd@queasysnail.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).