Skip to contentSkip to conversation

mgmt-tester: Fix null dereference issue reported by scan-build

PATCH Applied Tedd Ho-Jeong An 3 participants 3 messages Jun 23, 2022 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mgmt-tester: Fix null dereference issue reported by scan-build

From: Tedd Ho-Jeong An <[email protected]>

This patch fixes the null dereference reported by the scan-build.

tools/mgmt-tester.c:12025:28: warning: Access to field 'cap_len' results in a dereference of a null pointer (loaded from variable 'rp') [core.NullDereference]

        if (sizeof(rp->cap_len) + rp->cap_len != length) {
                                  ^~~~~~~~~~~
---
 tools/mgmt-tester.c | 2 ++
 1 file changed, 2 insertions(+)
tools/mgmt-tester.c +2 -0
index f45a6c015..6018327f1 100644
@@ -12020,12 +12020,14 @@ static void read_50_controller_cap_complete(uint8_t status, uint16_t length,
 		tester_warn("Failed to read advertising features: %s (0x%02x)",
 						mgmt_errstr(status), status);
 		tester_test_failed();
+		return;
 	}
 
 	if (sizeof(rp->cap_len) + rp->cap_len != length) {
 		tester_warn("Controller capabilities malformed, size %zu != %u",
 				sizeof(rp->cap_len) + rp->cap_len, length);
 		tester_test_failed();
+		return;
 	}
 
 	while (offset < rp->cap_len) {
Signature · 1 line
2.34.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=653027

---Test result---

Test Summary:

CheckPatch                    PASS      1.04 seconds
GitLint                       PASS      0.74 seconds
Prep - Setup ELL              PASS      50.02 seconds
Build - Prep                  PASS      0.61 seconds
Build - Configure             PASS      9.94 seconds
Build - Make                  PASS      1476.84 seconds
Make Check                    PASS      12.26 seconds
Make Check w/Valgrind         PASS      531.33 seconds
Make Distcheck                PASS      274.83 seconds
Build w/ext ELL - Configure   PASS      10.00 seconds
Build w/ext ELL - Make        PASS      1453.92 seconds
Incremental Build with patchesPASS      0.00 seconds

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Tedd Ho-Jeong An
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 9 lines · On Wed, 22 Jun 2022 21:45:20 -0700 you wrote:

From: Tedd Ho-Jeong An <[email protected]>

This patch fixes the null dereference reported by the scan-build.

tools/mgmt-tester.c:12025:28: warning: Access to field 'cap_len' results in a dereference of a null pointer (loaded from variable 'rp') [core.NullDereference]

[...]

Here is the summary with links:
- [BlueZ] mgmt-tester: Fix null dereference issue reported by scan-build

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=e3c92f1f786f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html