diff mbox series

[BlueZ,v2] shared/csip: add NULL checks to foreach_csis_service()

Message ID 20240702090120.33631-1-r.smirnov@omp.ru (mailing list archive)
State New
Headers show
Series [BlueZ,v2] shared/csip: add NULL checks to foreach_csis_service() | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Roman Smirnov July 2, 2024, 9:01 a.m. UTC
Make foreach_csis_service() safe for passing NULL pointers.

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

 src/shared/csip.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

bluez.test.bot@gmail.com July 2, 2024, 10:43 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=867455

---Test result---

Test Summary:
CheckPatch                    PASS      0.45 seconds
GitLint                       PASS      0.32 seconds
BuildEll                      PASS      24.60 seconds
BluezMake                     PASS      1759.30 seconds
MakeCheck                     PASS      13.23 seconds
MakeDistcheck                 PASS      179.15 seconds
CheckValgrind                 PASS      253.45 seconds
CheckSmatch                   PASS      360.66 seconds
bluezmakeextell               PASS      120.64 seconds
IncrementalBuild              PASS      1528.80 seconds
ScanBuild                     PASS      1016.14 seconds



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/shared/csip.c b/src/shared/csip.c
index 87b4590d9..9a734e7d6 100644
--- a/src/shared/csip.c
+++ b/src/shared/csip.c
@@ -611,6 +611,9 @@  static void foreach_csis_service(struct gatt_db_attribute *attr,
 	struct bt_csip *csip = user_data;
 	struct bt_csis *csis = csip_get_csis(csip);
 
+	if (!csis || !attr)
+		return;
+
 	csis->service = attr;
 
 	gatt_db_service_set_claimed(attr, true);