linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BlueZ PATCH] device: Fix the return type of device_irk_cmp()
@ 2025-11-15 22:08 Andrey Smirnov
  2025-11-15 23:26 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Smirnov @ 2025-11-15 22:08 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Andrey Smirnov, Luiz Augusto von Dentz

The return value from device_irk_cmp() is returned directly from
device_addr_type_cmp() which implements a memcmp()-like interface, so
we need to return an int() and a zero for equality. Returning bool
will cause false positives since false is 0 and true is 1.

Fixes: f1fb4f95f49e ("core: Fix not resolving addresses")
Cc: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 src/device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/device.c b/src/device.c
index 434bdf721..26729512f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -5422,24 +5422,24 @@ static bool addr_is_resolvable(const bdaddr_t *bdaddr, uint8_t addr_type)
 	}
 }

-static bool device_irk_cmp(const struct btd_device *device,
+static int device_irk_cmp(const struct btd_device *device,
 				const struct device_addr_type *addr)
 {
 	struct bt_crypto *crypto;
 	uint8_t hash[3];

 	if (!device->irk)
-		return false;
+		return -1;

 	crypto = bt_crypto_new();
 	if (!crypto)
-		return false;
+		return -1;

 	bt_crypto_ah(crypto, device->irk, addr->bdaddr.b + 3, hash);

 	bt_crypto_unref(crypto);

-	return !memcmp(addr, hash, 3);
+	return memcmp(addr, hash, 3);
 }

 int device_addr_type_cmp(gconstpointer a, gconstpointer b)
--
2.43.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [BlueZ] device: Fix the return type of device_irk_cmp()
  2025-11-15 22:08 [BlueZ PATCH] device: Fix the return type of device_irk_cmp() Andrey Smirnov
@ 2025-11-15 23:26 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2025-11-15 23:26 UTC (permalink / raw)
  To: linux-bluetooth, andrew.smirnov

[-- Attachment #1: Type: text/plain, Size: 1262 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=1023879

---Test result---

Test Summary:
CheckPatch                    PENDING   0.29 seconds
GitLint                       PENDING   0.27 seconds
BuildEll                      PASS      19.95 seconds
BluezMake                     PASS      2582.05 seconds
MakeCheck                     PASS      20.02 seconds
MakeDistcheck                 PASS      183.38 seconds
CheckValgrind                 PASS      236.32 seconds
CheckSmatch                   PASS      310.68 seconds
bluezmakeextell               PASS      127.82 seconds
IncrementalBuild              PENDING   0.21 seconds
ScanBuild                     PASS      910.65 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-15 23:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-15 22:08 [BlueZ PATCH] device: Fix the return type of device_irk_cmp() Andrey Smirnov
2025-11-15 23:26 ` [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;
as well as URLs for NNTP newsgroup(s).