Skip to contentSkip to conversation

monitor: Fix decoding Read Local Supported Codec Capabilities

PATCH Applied Kiran K 3 participants 3 messages Mar 7, 2021 – Mar 15, 2021 Bluetooth drivers

lore
Share & tools
lore

Kiran K

author
#0 lore raw

PATCH 1/1 monitor: Fix decoding Read Local Supported Codec Capabilities

Codec capabilities wern't properly decoded due to wrong offset

< HCI Command: Read Local Supported Codec Capabilities (0x04|0x000e) plen 7

        Codec: A-law log (0x01)
        Logical Transport Type: 0x01
          Codec supported over BR/EDR ACL
        Direction: Input (Host to Controller) (0x00)
Quoted 1 line

HCI Event: Command Complete (0x0e) plen 18

Read Local Supported Codec Capabilities (0x04|0x000e) ncmd 1
Status: Success (0x00)
Number of codec capabilities: 3
Capabilities #0:
aa bb cc dd ....
Capabilities #1:
11 22 33 44 55 ."3DU
Capabilities #2:
ff .

---
 monitor/packet.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
monitor/packet.c +6 -6
index fb265028c213..75b61d57aa7c 100644
@@ -6032,23 +6032,23 @@ static void read_local_codec_caps_rsp(const void *data, uint8_t size)
 	print_status(rsp->status);
 	print_field("Number of codec capabilities: %d", rsp->num);
 
-	data += sizeof(rsp);
-	size -= sizeof(rsp);
+	data += sizeof(*rsp);
+	size -= sizeof(*rsp);
 
 	for (i = 0; i < rsp->num; i++) {
 		const struct bt_hci_codec_caps *caps = data;
 
-		if (size < sizeof(caps)) {
+		if (size < sizeof(*caps)) {
 			print_field("Invalid capabilities: %u < %zu",
-						size, sizeof(caps));
+						size, sizeof(*caps));
 			return;
 		}
 
 		print_field(" Capabilities #%u:", i);
 		packet_hexdump(caps->data, caps->len);
 
-		data += caps->len;
-		size -= caps->len;
+		data += 1 + caps->len;
+		size -= 1 + caps->len;
 	}
 }
 
Signature · 1 line
2.17.1
#1 lore raw

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=443331

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS

---
Regards,
Linux Bluetooth

maintainer Applied
#2 lore raw

Hi Kiran,

Quoted 20 lines · On Sun, Mar 7, 2021 at 1:39 AM <[email protected]> wrote:

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=443331

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

Quoted 8 lines

##############################
Test: MakeCheck - PASS

---
Regards,
Linux Bluetooth

Applied, thanks.

Signature · 1 line
Luiz Augusto von Dentz