diff mbox series

[BlueZ] shared/bap: Fix scan-build warning

Message ID 20230113211638.303409-1-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ] shared/bap: Fix scan-build warning | expand

Commit Message

Luiz Augusto von Dentz Jan. 13, 2023, 9:16 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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

Comments

bluez.test.bot@gmail.com Jan. 13, 2023, 10:39 p.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=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
patchwork-bot+bluetooth@kernel.org Jan. 13, 2023, 11 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 Fri, 13 Jan 2023 13:16:38 -0800 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> 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!
diff mbox series

Patch

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 0cafb75e69d0..88697988e991 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -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);