* [PATCH BlueZ] device: fix inverted NULL check in gatt_db clone
@ 2026-05-18 2:12 Zhao Dongdong
2026-05-18 6:36 ` [BlueZ] " bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Zhao Dongdong @ 2026-05-18 2:12 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Zhao Dongdong
From: Zhao Dongdong <zhaodongdong@kylinos.cn>
gatt_db_clone() returns NULL on failure so the condition was inverted.
With the old check a successful clone (non-NULL) would return false and
skip swapping the device's GATT database, while a failure (NULL) would
fall through and dereference a NULL pointer a few lines below.
Fix by negating the condition: only bail out early if the clone failed;
proceed with the swap when the clone actually succeeds.
Fixes: cbe4144 ("set: Attempt to use existing set gatt-db")
Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn>
---
src/device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/device.c b/src/device.c
index 28515054c..bea893301 100644
--- a/src/device.c
+++ b/src/device.c
@@ -7896,7 +7896,7 @@ bool btd_device_set_gatt_db(struct btd_device *device, struct gatt_db *db)
return false;
clone = gatt_db_clone(db);
- if (clone)
+ if (!clone)
return false;
gatt_db_unregister(device->db, device->db_id);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* RE: [BlueZ] device: fix inverted NULL check in gatt_db clone
2026-05-18 2:12 [PATCH BlueZ] device: fix inverted NULL check in gatt_db clone Zhao Dongdong
@ 2026-05-18 6:36 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-05-18 6:36 UTC (permalink / raw)
To: linux-bluetooth, winter91
[-- Attachment #1: Type: text/plain, Size: 1830 bytes --]
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=1096236
---Test result---
Test Summary:
CheckPatch FAIL 0.40 seconds
GitLint PASS 0.27 seconds
BuildEll PASS 17.72 seconds
BluezMake PASS 605.54 seconds
CheckSmatch PASS 311.42 seconds
bluezmakeextell PASS 167.26 seconds
IncrementalBuild PASS 592.92 seconds
ScanBuild PASS 915.40 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ] device: fix inverted NULL check in gatt_db clone
WARNING:BAD_FIXES_TAG: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: cbe4144dea6f ("set: Attempt to use existing set gatt-db")'
#87:
Fixes: cbe4144 ("set: Attempt to use existing set gatt-db")
/github/workspace/src/patch/14577840.patch total: 0 errors, 1 warnings, 8 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/patch/14577840.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
https://github.com/bluez/bluez/pull/2132
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-18 6:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-18 2:12 [PATCH BlueZ] device: fix inverted NULL check in gatt_db clone Zhao Dongdong
2026-05-18 6:36 ` [BlueZ] " bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox