2023-01-13 21:32:46

by Luiz Augusto von Dentz

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

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);
--
2.37.3


2023-01-13 22:44:12

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ] shared/bap: Fix scan-build warning

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

2023-01-13 23:07:58

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH BlueZ] shared/bap: Fix scan-build warning

Hello:

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

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