Skip to contentSkip to conversation

shared/bap: Fix scan-build warning

PATCH Applied Luiz Augusto von Dentz 3 participants 3 messages Jan 13, 2023 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 shared/bap: Fix scan-build warning

From: Luiz Augusto von Dentz <[email protected]>

This fixes the following warning:

src/shared/bap.c:2268:26: warning: Access to field 'iov_len' results in a dereference of a null pointer (loaded from variable 'cont')

        return iov_append(data, cont->iov_len, cont->iov_base);
	                                ^~~~~~~~~~~~~
---
 src/shared/bap.c | 6 ++++++
 1 file changed, 6 insertions(+)
src/shared/bap.c +6 -0
index 0cafb75e69d0..88697988e991 100644
@@ -2261,6 +2261,12 @@ static void *ltv_merge(struct iovec *data, struct iovec *cont)
 {
 	uint8_t delimiter = 0;
 
+	if (!data)
+		return NULL;
+
+	if (!cont || !cont->iov_len || !cont->iov_base)
+		return data->iov_base;
+
 	iov_append(data, sizeof(delimiter), &delimiter);
 
 	return iov_append(data, cont->iov_len, cont->iov_base);
Signature · 1 line
2.37.3
#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=711925

---Test result---

Test Summary:

CheckPatch                    PASS      0.77 seconds
GitLint                       FAIL      0.63 seconds
BuildEll                      PASS      27.43 seconds
BluezMake                     PASS      980.77 seconds
MakeCheck                     PASS      11.74 seconds
MakeDistcheck                 PASS      149.00 seconds
CheckValgrind                 PASS      244.73 seconds
CheckSmatch                   PASS      325.49 seconds
bluezmakeextell               PASS      97.76 seconds
IncrementalBuild              PASS      831.42 seconds
ScanBuild                     PASS      1014.14 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ] shared/bap: Fix scan-build warning

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
10: B3 Line contains hard tab characters (\t): " ^~~~~~~~~~~~~"

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Luiz Augusto von Dentz
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 10 lines · On Fri, 13 Jan 2023 13:16:38 -0800 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

This fixes the following warning:

src/shared/bap.c:2268:26: warning: Access to field 'iov_len' results in a dereference of a null pointer (loaded from variable 'cont')

        return iov_append(data, cont->iov_len, cont->iov_base);
	                                ^~~~~~~~~~~~~

[...]

Here is the summary with links:
- [BlueZ] shared/bap: Fix scan-build warning

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

You are awesome, thank you!

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