2022-06-23 05:07:30

by Tedd Ho-Jeong An

[permalink] [raw]
Subject: [BlueZ PATCH] 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(+)

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) {
--
2.34.1


2022-06-23 06:43:03

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ] mgmt-tester: Fix null dereference issue reported by scan-build

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

2022-06-23 23:41:33

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [BlueZ PATCH] mgmt-tester: Fix null dereference issue reported by scan-build

Hello:

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

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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html