diff mbox series

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

Message ID 20220623044520.458626-1-hj.tedd.an@gmail.com
State New
Headers show
Series [BlueZ] mgmt-tester: Fix null dereference issue reported by scan-build | expand

Commit Message

Tedd Ho-Jeong An June 23, 2022, 4:45 a.m. UTC
From: Tedd Ho-Jeong An <tedd.an@intel.com>

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(+)

Comments

bluez.test.bot@gmail.com June 23, 2022, 6:34 a.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=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
patchwork-bot+bluetooth@kernel.org June 23, 2022, 11:30 p.m. UTC | #2
Hello:

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

On Wed, 22 Jun 2022 21:45:20 -0700 you wrote:
> From: Tedd Ho-Jeong An <tedd.an@intel.com>
> 
> 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!
diff mbox series

Patch

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index f45a6c015..6018327f1 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -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) {