diff mbox series

[BlueZ] shared/gatt-db: Fix scan-build warning

Message ID 20220921215342.2263924-1-luiz.dentz@gmail.com (mailing list archive)
State New, archived
Headers show
Series [BlueZ] shared/gatt-db: Fix scan-build warning | 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/setupell success Setup ELL PASS
tedd_an/buildprep success Build Prep PASS
tedd_an/build success Build Configuration PASS
tedd_an/makecheck success Make Check PASS
tedd_an/makecheckvalgrind success Make Check PASS
tedd_an/makedistcheck success Make Distcheck PASS
tedd_an/build_extell success Build External ELL PASS
tedd_an/build_extell_make success Build Make with External ELL PASS
tedd_an/scan_build warning Scan-Build: src/shared/gatt-db.c:725:5: warning: Access to field 'handle' results in a dereference of a null pointer service->attributes[0]->handle == handle) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated.

Commit Message

Luiz Augusto von Dentz Sept. 21, 2022, 9:53 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This fixes the following warning:

src/shared/gatt-db.c:1339:2: warning: Undefined or garbage value
returned to caller [core.uninitialized.UndefReturn]
        return data.num_of_res;
        ^~~~~~~~~~~~~~~~~~~~~~
---
 src/shared/gatt-db.c | 1 +
 1 file changed, 1 insertion(+)

Comments

bluez.test.bot@gmail.com Sept. 21, 2022, 11:12 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=679177

---Test result---

Test Summary:
CheckPatch                    PASS      1.45 seconds
GitLint                       PASS      1.14 seconds
Prep - Setup ELL              PASS      28.57 seconds
Build - Prep                  PASS      0.86 seconds
Build - Configure             PASS      9.10 seconds
Build - Make                  PASS      1056.77 seconds
Make Check                    PASS      12.48 seconds
Make Check w/Valgrind         PASS      306.51 seconds
Make Distcheck                PASS      260.10 seconds
Build w/ext ELL - Configure   PASS      9.34 seconds
Build w/ext ELL - Make        PASS      91.15 seconds
Incremental Build w/ patches  PASS      0.00 seconds
Scan Build                    WARNING   592.37 seconds

Details
##############################
Test: Scan Build - WARNING
Desc: Run Scan Build with patches
Output:
*****************************************************************************
The bugs reported by the scan-build may or may not be caused by your patches.
Please check the list and fix the bugs if they are caused by your patch.
*****************************************************************************
src/shared/gatt-db.c:725:5: warning: Access to field 'handle' results in a dereference of a null pointer
                                service->attributes[0]->handle == handle)
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.




---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index 32cbf6cdc38b..ff2502ff9681 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
@@ -1328,6 +1328,7 @@  unsigned int gatt_db_find_by_type_value(struct gatt_db *db,
 {
 	struct find_by_type_value_data data;
 
+	memset(&data, 0, sizeof(data));
 	data.func = func;
 	data.user_data = user_data;
 	data.value = value;