diff mbox series

[BlueZ,1/4] mesh: Correct u32 to u8 log transformation

Message ID 20220926130110.2146-2-isak.westin@loytec.com (mailing list archive)
State Accepted
Commit 5b569e3d14a38247c69a16d80c5f7c8b77482505
Headers show
Series Mesh: Fix heartbeat publication/subscription | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS
tedd_an/setupell success Setup ELL PASS
tedd_an/buildprep success Build Prep PASS
tedd_an/build success Build Configuration PASS
tedd_an/makecheck success Make Check PASS
tedd_an/makecheckvalgrind success Make Check PASS
tedd_an/makedistcheck success Make Distcheck PASS
tedd_an/build_extell success Build External ELL PASS
tedd_an/build_extell_make success Build Make with External ELL PASS
tedd_an/incremental_build success Pass
tedd_an/scan_build success Pass

Commit Message

Isak Westin Sept. 26, 2022, 1:01 p.m. UTC
Fixed the log transformation to correctly follow the value mapping
defined in the mesh profile (section 4.1.2).
---
 mesh/cfgmod-server.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

bluez.test.bot@gmail.com Sept. 26, 2022, 3:54 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=680522

---Test result---

Test Summary:
CheckPatch                    PASS      3.06 seconds
GitLint                       PASS      2.07 seconds
Prep - Setup ELL              PASS      35.30 seconds
Build - Prep                  PASS      0.83 seconds
Build - Configure             PASS      10.94 seconds
Build - Make                  PASS      1231.41 seconds
Make Check                    PASS      13.40 seconds
Make Check w/Valgrind         PASS      380.05 seconds
Make Distcheck                PASS      324.29 seconds
Build w/ext ELL - Configure   PASS      11.27 seconds
Build w/ext ELL - Make        PASS      115.80 seconds
Incremental Build w/ patches  PASS      538.07 seconds
Scan Build                    PASS      738.03 seconds



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c
index 9bc2f1c97..33796d05a 100644
--- a/mesh/cfgmod-server.c
+++ b/mesh/cfgmod-server.c
@@ -455,14 +455,14 @@  done:
 static uint8_t uint32_to_log(uint32_t value)
 {
 	uint32_t val = 1;
-	uint8_t ret = 1;
+	uint8_t ret = 0;
 
 	if (!value)
 		return 0;
 	else if (value > 0x10000)
 		return 0xff;
 
-	while (val < value) {
+	while (val <= value) {
 		val <<= 1;
 		ret++;
 	}
@@ -495,7 +495,7 @@  static uint16_t hb_subscription_get(struct mesh_node *node, int status)
 	l_put_le16(sub->dst, msg + n);
 	n += 2;
 	msg[n++] = uint32_to_log(time_now.tv_sec);
-	msg[n++] = uint32_to_log(sub->count);
+	msg[n++] = sub->count != 0xffff ? uint32_to_log(sub->count) : 0xff;
 	msg[n++] = sub->count ? sub->min_hops : 0;
 	msg[n++] = sub->max_hops;
 
@@ -538,7 +538,7 @@  static uint16_t hb_publication_get(struct mesh_node *node, int status)
 	msg[n++] = status;
 	l_put_le16(pub->dst, msg + n);
 	n += 2;
-	msg[n++] = uint32_to_log(pub->count);
+	msg[n++] = pub->count != 0xffff ? uint32_to_log(pub->count) : 0xff;
 	msg[n++] = uint32_to_log(pub->period);
 	msg[n++] = pub->ttl;
 	l_put_le16(pub->features, msg + n);