X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=rculfhash.c;h=1720afb61669e971968fc2cfcd994db3e6b7b8be;hp=9aeb3e76598071c0b450a4287c2fe8c615bc9a29;hb=8129be4e7b668906bdbb68c4d7c9fcb403ae977a;hpb=14044b37bb7ba51676f1c3f139facae9b06dbc51 diff --git a/rculfhash.c b/rculfhash.c index 9aeb3e7..1720afb 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -621,6 +621,9 @@ struct cds_lfht *cds_lfht_new(cds_lfht_hash_fct hash_fct, struct cds_lfht *ht; unsigned long order; + /* init_size must be power of two */ + if (init_size & (init_size - 1)) + return NULL; ht = calloc(1, sizeof(struct cds_lfht)); ht->hash_fct = hash_fct; ht->compare_fct = compare_fct;