All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Florian Westphal <fw@strlen.de>
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, Thomas Graf <tgraf@suug.ch>
Subject: Re: rhashtable - Cap total number of entries to 2^31
Date: Thu, 27 Apr 2017 18:13:05 +0800	[thread overview]
Message-ID: <20170427101305.GA1701@gondor.apana.org.au> (raw)
In-Reply-To: <20170427101134.GB448@breakpoint.cc>

On Thu, Apr 27, 2017 at 12:11:34PM +0200, Florian Westphal wrote:
>
> > +	/* Cap total entries at 2^31 to avoid nelems overflow. */
> > +	ht->max_elems = 1u << 31;
> > +	if (ht->p.max_size < ht->max_elems / 2)
> > +		ht->max_elems = ht->p.max_size * 2;
> > +
> 
> Looks like instead of adding this max_elems you could instead have fixed this via
> 
> if (!ht->p.max_size)
> 	ht->p.max_size = INT_MAX / 2;
> 
> if (ht->p.max_size > INT_MAX / 2)
> 	return -EINVAL;

No that doesn't do the same thing.  Setting max_size caps the table
size and I don't want to do that at all.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2017-04-27 10:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25  9:41 [PATCH net-next] rhashtable: remove insecure_max_entries param Florian Westphal
2017-04-25 11:04 ` Herbert Xu
2017-04-25 11:23   ` Florian Westphal
2017-04-25 13:28     ` Herbert Xu
2017-04-25 14:17       ` Florian Westphal
2017-04-25 14:48         ` David Miller
2017-04-27  5:44           ` rhashtable - Cap total number of entries to 2^31 Herbert Xu
2017-04-27 10:11             ` Florian Westphal
2017-04-27 10:13               ` Herbert Xu [this message]
2017-04-27 15:48             ` David Miller
2017-04-27 21:16             ` Florian Fainelli
2017-04-27 22:21               ` Florian Fainelli
2017-04-27 22:28                 ` [PATCH net-next] rhashtable: Make sure max_size is non zero Florian Fainelli
2017-04-27 22:32                   ` Florian Fainelli
2017-04-27 22:30                 ` Florian Fainelli
2017-04-28  6:10                   ` [PATCH net-next] rhashtable: Do not lower max_elems when max_size is zero Herbert Xu
2017-04-28 14:14                     ` David Miller
2017-04-28 15:42                       ` Florian Fainelli
2017-04-28 10:23                 ` rhashtable - Cap total number of entries to 2^31 Christian Borntraeger
2017-04-28 11:31                   ` Herbert Xu
2017-04-28 11:43                     ` Christian Borntraeger
2017-04-28  2:10             ` [lkp-robot] [rhashtable ] df7008bdd5: Kernel_panic-not_syncing:rtnetlink_init:cannot_initialize_rtnetlink kernel test robot
2017-04-28  2:10               ` kernel test robot
2017-04-26 18:39 ` [PATCH net-next] rhashtable: remove insecure_max_entries param David Miller

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=20170427101305.GA1701@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=netdev@vger.kernel.org \
    --cc=tgraf@suug.ch \
    /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.