diff mbox series

[BlueZ,v2] avdtp: add NULL checks to avdtp_has_stream()

Message ID 20240629083619.11804-1-r.smirnov@omp.ru
State Superseded
Headers show
Series [BlueZ,v2] avdtp: add NULL checks to avdtp_has_stream() | expand

Commit Message

Roman Smirnov June 29, 2024, 8:36 a.m. UTC
Make avdtp_has_stream() safe for passing NULL pointers.

Found with the SVACE static analysis tool.
---
 V1 -> V2: added check for stream

 profiles/audio/avdtp.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

bluez.test.bot@gmail.com June 29, 2024, 10:39 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=866803

---Test result---

Test Summary:
CheckPatch                    PASS      0.36 seconds
GitLint                       PASS      0.20 seconds
BuildEll                      PASS      24.32 seconds
BluezMake                     PASS      1685.08 seconds
MakeCheck                     PASS      13.62 seconds
MakeDistcheck                 PASS      176.12 seconds
CheckValgrind                 PASS      256.04 seconds
CheckSmatch                   PASS      351.98 seconds
bluezmakeextell               PASS      118.74 seconds
IncrementalBuild              PASS      1385.55 seconds
ScanBuild                     PASS      988.63 seconds



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org July 1, 2024, 2:20 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 Sat, 29 Jun 2024 11:36:18 +0300 you wrote:
> Make avdtp_has_stream() safe for passing NULL pointers.
> 
> Found with the SVACE static analysis tool.
> ---
>  V1 -> V2: added check for stream
> 
>  profiles/audio/avdtp.c | 3 +++
>  1 file changed, 3 insertions(+)

Here is the summary with links:
  - [BlueZ,v2] avdtp: add NULL checks to avdtp_has_stream()
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=be0b08770e92

You are awesome, thank you!
diff mbox series

Patch

diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 3667e0840..64735c5ee 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -3918,6 +3918,9 @@  struct btd_device *avdtp_get_device(struct avdtp *session)
 
 gboolean avdtp_has_stream(struct avdtp *session, struct avdtp_stream *stream)
 {
+	if (!session || !stream)
+		return FALSE;
+
 	return g_slist_find(session->streams, stream) ? TRUE : FALSE;
 }