Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e20fa6d4 authored by Vishwath Mohan's avatar Vishwath Mohan
Browse files

Fix BTM callbacks so callee and caller types match

This CL fixes inconsistencies between the actual type of a callback
function, and the type assumed at the call site. This respects the
intended function signature.

For P, we plan to enable control-flow integrity (CFI) across multiple
platform components, including BT. This mismatch will break CFI and
cause runtime errors when enabled - so this is also a preemptive
measure to get BT compatible in preparation.

Bug: 30227045
Test: Builds and runs without errors when CFI is enabled.
Change-Id: I8970e6866d8b37a9adf5e040db993d30f1b5103a
parent 2f65d957
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ static uint8_t bta_dm_authentication_complete_cback(const RawAddress& bd_addr,
                                                    DEV_CLASS dev_class,
                                                    BD_NAME bd_name,
                                                    int result);
static void bta_dm_local_name_cback(const RawAddress& bd_addr);
static void bta_dm_local_name_cback(void* p_name);
static bool bta_dm_check_av(uint16_t event);
static void bta_dm_bl_change_cback(tBTM_BL_EVENT_DATA* p_data);

@@ -2759,7 +2759,7 @@ static uint8_t bta_dm_sp_cback(tBTM_SP_EVT event, tBTM_SP_EVT_DATA* p_data) {
 * Returns          void
 *
 ******************************************************************************/
static void bta_dm_local_name_cback(UNUSED_ATTR const RawAddress& p_name) {
static void bta_dm_local_name_cback(UNUSED_ATTR void* p_name) {
  tBTA_DM_SEC sec_event;

  sec_event.enable.status = BTA_SUCCESS;
+1 −1
Original line number Diff line number Diff line
@@ -618,7 +618,7 @@ void BTM_VendorSpecificCommand(uint16_t opcode, uint8_t param_len,
 *
 ******************************************************************************/
void btm_vsc_complete(uint8_t* p, uint16_t opcode, uint16_t evt_len,
                      tBTM_CMPL_CB* p_vsc_cplt_cback) {
                      tBTM_VSC_CMPL_CB* p_vsc_cplt_cback) {
  tBTM_VSC_CMPL vcs_cplt_params;

  /* If there was a callback address for vcs complete, call it */
+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ extern void btm_ble_resolving_list_remove_dev(tBTM_SEC_DEV_REC* p_dev_rec);

/* Vendor Specific Command complete evt handler */
extern void btm_vsc_complete(uint8_t* p, uint16_t cc_opcode, uint16_t evt_len,
                             tBTM_CMPL_CB* p_vsc_cplt_cback);
                             tBTM_VSC_CMPL_CB* p_vsc_cplt_cback);
extern void btm_inq_db_reset(void);
extern void btm_vendor_specific_evt(uint8_t* p, uint8_t evt_len);
extern void btm_delete_stored_link_key_complete(uint8_t* p);
+3 −3
Original line number Diff line number Diff line
@@ -1001,7 +1001,7 @@ static void btu_hcif_hdl_command_complete(uint16_t opcode, uint8_t* p,
#endif
    default:
      if ((opcode & HCI_GRP_VENDOR_SPECIFIC) == HCI_GRP_VENDOR_SPECIFIC)
        btm_vsc_complete(p, opcode, evt_len, (tBTM_CMPL_CB*)p_cplt_cback);
        btm_vsc_complete(p, opcode, evt_len, (tBTM_VSC_CMPL_CB*)p_cplt_cback);
      break;
  }
}
@@ -1174,14 +1174,14 @@ static void btu_hcif_hdl_command_status(uint16_t opcode, uint8_t status,
          default:
            if ((opcode & HCI_GRP_VENDOR_SPECIFIC) == HCI_GRP_VENDOR_SPECIFIC)
              btm_vsc_complete(&status, opcode, 1,
                               (tBTM_CMPL_CB*)p_vsc_status_cback);
                               (tBTM_VSC_CMPL_CB*)p_vsc_status_cback);
            break;
        }

      } else {
        if ((opcode & HCI_GRP_VENDOR_SPECIFIC) == HCI_GRP_VENDOR_SPECIFIC)
          btm_vsc_complete(&status, opcode, 1,
                           (tBTM_CMPL_CB*)p_vsc_status_cback);
                           (tBTM_VSC_CMPL_CB*)p_vsc_status_cback);
      }
  }
}