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 <herb...@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt