diff options
author | Adrian Szyndela <adrian.s@samsung.com> | 2019-07-19 10:23:27 +0200 |
---|---|---|
committer | Adrian Szyndela <adrian.s@samsung.com> | 2019-07-19 10:23:27 +0200 |
commit | 19feaf09d3bd71f6339f51651936ca9c40e1a805 (patch) | |
tree | 40b09ea71332daa7158ee14a8fac79313fa5b6e3 | |
parent | 64a1c8f469c1d5375e343b2dffa50f5168ed3f45 (diff) | |
download | dbus-19feaf09d3bd71f6339f51651936ca9c40e1a805.tar.gz dbus-19feaf09d3bd71f6339f51651936ca9c40e1a805.tar.bz2 dbus-19feaf09d3bd71f6339f51651936ca9c40e1a805.zip |
kdbus: fix computing bloom filterssubmit/tizen/20190719.104741accepted/tizen/unified/20190722.074825
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
-rwxr-xr-x | dbus/kdbus-common.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/dbus/kdbus-common.c b/dbus/kdbus-common.c index 70ad9b0b..7aff708b 100755 --- a/dbus/kdbus-common.c +++ b/dbus/kdbus-common.c @@ -1311,16 +1311,16 @@ _kdbus_bloom_add_data (kdbus_t *kdbus, 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) { |