diff mbox series

[BlueZ,v1,1/2] shared/gatt-db: Fix gatt_db_clone

Message ID 20240611163542.1161789-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit a37e475f7252858832d5a1b1e100beb21a7c9a4b
Headers show
Series [BlueZ,v1,1/2] shared/gatt-db: Fix gatt_db_clone | 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/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Luiz Augusto von Dentz June 11, 2024, 4:35 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The process of cloning an existing db shall also clone certain values
that are considered when calculating the hash since the resulting clone
shall have the same hash.
---
 src/shared/gatt-db.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

Comments

bluez.test.bot@gmail.com June 11, 2024, 6:37 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=860868

---Test result---

Test Summary:
CheckPatch                    PASS      1.03 seconds
GitLint                       PASS      0.71 seconds
BuildEll                      PASS      25.32 seconds
BluezMake                     PASS      1756.78 seconds
MakeCheck                     PASS      13.33 seconds
MakeDistcheck                 PASS      185.65 seconds
CheckValgrind                 PASS      260.47 seconds
CheckSmatch                   PASS      366.67 seconds
bluezmakeextell               PASS      122.96 seconds
IncrementalBuild              PASS      3149.71 seconds
ScanBuild                     PASS      1051.62 seconds



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org June 12, 2024, 5:20 p.m. UTC | #2
Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue, 11 Jun 2024 12:35:41 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> The process of cloning an existing db shall also clone certain values
> that are considered when calculating the hash since the resulting clone
> shall have the same hash.
> ---
>  src/shared/gatt-db.c | 23 ++++++++++++++++++++---
>  1 file changed, 20 insertions(+), 3 deletions(-)

Here is the summary with links:
  - [BlueZ,v1,1/2] shared/gatt-db: Fix gatt_db_clone
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a37e475f7252
  - [BlueZ,v1,2/2] settings: Add more debug logs
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=891552999317

You are awesome, thank you!
diff mbox series

Patch

diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index 16abcba2ec1c..b35763410d17 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
@@ -281,18 +281,35 @@  static void service_clone(void *data, void *user_data)
 		/* Only clone values for characteristics declaration since that
 		 * is considered when calculating the db hash.
 		 */
-		if (bt_uuid_len(&attr->uuid) == 2 &&
-				attr->uuid.value.u16 == GATT_CHARAC_UUID)
+		if (bt_uuid_len(&attr->uuid) != 2) {
+			clone->attributes[i] = new_attribute(clone,
+							attr->handle,
+							&attr->uuid,
+							NULL, 0);
+			continue;
+		}
+
+		/* Attribute values that are used for generating the hash needs
+		 * to be cloned as well.
+		 */
+		switch (attr->uuid.value.u16) {
+		case GATT_PRIM_SVC_UUID:
+		case GATT_SND_SVC_UUID:
+		case GATT_INCLUDE_UUID:
+		case GATT_CHARAC_UUID:
 			clone->attributes[i] = new_attribute(clone,
 							attr->handle,
 							&attr->uuid,
 							attr->value,
 							attr->value_len);
-		else
+			break;
+		default:
 			clone->attributes[i] = new_attribute(clone,
 							attr->handle,
 							&attr->uuid,
 							NULL, 0);
+			break;
+		}
 	}
 
 	queue_push_tail(db->services, clone);