rculfhash: Check that init size is power of 2
[urcu.git] / rculfhash.c
index 9aeb3e76598071c0b450a4287c2fe8c615bc9a29..1720afb61669e971968fc2cfcd994db3e6b7b8be 100644 (file)
@@ -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;
This page took 0.021997 seconds and 4 git commands to generate.