From: Mathieu Desnoyers Date: Sat, 3 Sep 2011 18:33:06 +0000 (-0400) Subject: rculfhash: power power of two check should allow 0 X-Git-Tag: v0.7.0~43^2~185 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=49619ea0bfe494a27a62991e5360f0de8e4bdf1f;p=userspace-rcu.git rculfhash: power power of two check should allow 0 Signed-off-by: Mathieu Desnoyers --- diff --git a/rculfhash.c b/rculfhash.c index 807a22d..174c11c 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -622,7 +622,7 @@ struct cds_lfht *cds_lfht_new(cds_lfht_hash_fct hash_fct, unsigned long order; /* init_size must be power of two */ - if (init_size & (init_size - 1)) + if (init_size && (init_size & (init_size - 1))) return NULL; ht = calloc(1, sizeof(struct cds_lfht)); ht->hash_fct = hash_fct;