diff mbox series

[BlueZ,v1] shared/vcp: add NULL checks to foreach_aics_service()

Message ID 20240702085508.30513-1-r.smirnov@omp.ru
State Superseded
Headers show
Series [BlueZ,v1] shared/vcp: add NULL checks to foreach_aics_service() | expand

Commit Message

Roman Smirnov July 2, 2024, 8:55 a.m. UTC
Make foreach_aics_service() safe for passing NULL pointers.

Found with the SVACE static analysis tool.
---
 src/shared/vcp.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

patchwork-bot+bluetooth@kernel.org July 10, 2024, 2:30 p.m. UTC | #1
Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue, 2 Jul 2024 11:55:08 +0300 you wrote:
> Make foreach_aics_service() safe for passing NULL pointers.
> 
> Found with the SVACE static analysis tool.
> ---
>  src/shared/vcp.c | 3 +++
>  1 file changed, 3 insertions(+)

Here is the summary with links:
  - [BlueZ,v1] shared/vcp: add NULL checks to foreach_aics_service()
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=ba70a116d971

You are awesome, thank you!
diff mbox series

Patch

diff --git a/src/shared/vcp.c b/src/shared/vcp.c
index b7e17e448..1f84da4a0 100644
--- a/src/shared/vcp.c
+++ b/src/shared/vcp.c
@@ -2714,6 +2714,9 @@  static void foreach_aics_service(struct gatt_db_attribute *attr,
 	struct bt_vcp *vcp = user_data;
 	struct bt_aics *aics = vcp_get_aics(vcp);
 
+	if (!aics || !attr)
+		return;
+
 	aics->service = attr;
 
 	gatt_db_service_set_claimed(attr, true);