mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-13 09:54:36 -05:00
59bf3b75c7
https://review.lineageos.org/c/LineageOS/android_frameworks_base/+/353117 https://review.lineageos.org/q/topic:Q_asb_2023-03 https://review.lineageos.org/q/topic:Q_asb_2023-04 https://review.lineageos.org/q/topic:Q_asb_2023-05 https://review.lineageos.org/q/topic:Q_asb_2023-06 https://review.lineageos.org/q/topic:Q_asb_2023-07 https://review.lineageos.org/q/topic:Q_asb_2023-08 accounted for via patches: https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/376560 https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/376561 https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/376562 https://review.lineageos.org/q/topic:Q_asb_2023-09 https://review.lineageos.org/q/topic:Q_asb_2023-10 https://review.lineageos.org/q/topic:Q_asb_2023-11 accounted for via patches: https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/376563 accounted for via manifest change: https://review.lineageos.org/c/LineageOS/android_external_webp/+/376568 https://review.lineageos.org/q/topic:Q_asb_2023-12 https://review.lineageos.org/q/topic:Q_asb_2024-01 https://review.lineageos.org/q/topic:Q_asb_2024-02 https://review.lineageos.org/q/topic:Q_asb_2024-03 Signed-off-by: Tavi <tavi@divested.dev>
43 lines
1.4 KiB
Diff
43 lines
1.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Alexander Grund <flamefire89@gmail.com>
|
|
Date: Fri, 22 Dec 2023 14:45:39 +0100
|
|
Subject: [PATCH] Fix `find_rfc_slot_by_pending_sdp` not finding active slot
|
|
with max ID
|
|
|
|
UINT32_MAX is a valid `id` however using `rfc_slots[i].id < min_id`
|
|
with an initial `min_id = UINT32_MAX` can never find a slot with that id.
|
|
Use `<=` instead assuming the ids are unique anyway.
|
|
|
|
Also store the pointer to the slot directly instead of using a condition
|
|
in the return path.
|
|
|
|
Change-Id: I4c7d1d7a5203ee8df8e734441d121c46e80eaac4
|
|
---
|
|
btif/src/btif_sock_rfc.cc | 8 ++++----
|
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/btif/src/btif_sock_rfc.cc b/btif/src/btif_sock_rfc.cc
|
|
index 3c9e26e51..3f9dc559d 100644
|
|
--- a/btif/src/btif_sock_rfc.cc
|
|
+++ b/btif/src/btif_sock_rfc.cc
|
|
@@ -171,15 +171,15 @@ static rfc_slot_t* find_rfc_slot_by_id(uint32_t id) {
|
|
|
|
static rfc_slot_t* find_rfc_slot_by_pending_sdp(void) {
|
|
uint32_t min_id = UINT32_MAX;
|
|
- int slot = -1;
|
|
+ rfc_slot_t* slot = NULL;
|
|
for (size_t i = 0; i < ARRAY_SIZE(rfc_slots); ++i)
|
|
if (rfc_slots[i].id && rfc_slots[i].f.pending_sdp_request &&
|
|
- rfc_slots[i].id < min_id) {
|
|
+ rfc_slots[i].id <= min_id) {
|
|
min_id = rfc_slots[i].id;
|
|
- slot = i;
|
|
+ slot = &rfc_slots[i];
|
|
}
|
|
|
|
- return (slot == -1) ? NULL : &rfc_slots[slot];
|
|
+ return slot;
|
|
}
|
|
|
|
static bool is_requesting_sdp(void) {
|