The bloom filters computing had been implemented in the past, basing
on systemd. However, the reimplementation introduced two bugs:
- no clearing of 'p' variable;
- clearing of hash_index variable in a wrong place.
This fixes the bugs.
The same applies to glib.
Change-Id: Ie7c602c6bc881e38c62f41d482ab3785b03c5503
unsigned int hash_index = 0;
unsigned int c = 0;
- uint64_t p = 0;
bit_num = kdbus->bloom.size * 8;
if (bit_num > 1)
bytes_num = ((__builtin_clzll (bit_num) ^ 63U) + 7) / 8;
- for (cnt_1 = 0; cnt_1 < kdbus->bloom.n_hash; cnt_1++)
+ for (cnt_1 = 0, hash_index = 0; cnt_1 < kdbus->bloom.n_hash; cnt_1++)
{
- for (cnt_2 = 0, hash_index = 0; cnt_2 < bytes_num; cnt_2++)
+ uint64_t p = 0;
+ for (cnt_2 = 0; cnt_2 < bytes_num; cnt_2++)
{
if (c <= 0)
{