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

Commit caea3731 authored by liuchao's avatar liuchao Committed by Pavlin Radoslavov
Browse files

Fix a NULL-pointer check order reverse in GATTC_ConfigureMTU

This fixes a potential NULL-pointer check order reverse
in case failed to get TCB using the TCB index

Test: mm -j 8
Change-Id: I8fcc168d7d077f8df7c7abb9c325c5168fa8cd39
parent c5eb43b7
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -652,15 +652,15 @@ tGATT_STATUS GATTC_ConfigureMTU (uint16_t conn_id, uint16_t mtu)

    GATT_TRACE_API ("GATTC_ConfigureMTU conn_id=%d mtu=%d", conn_id, mtu );

    /* Validate that the link is BLE, not BR/EDR */
    if (p_tcb->transport != BT_TRANSPORT_LE)
    if ( (p_tcb == NULL) || (p_reg == NULL) || (mtu < GATT_DEF_BLE_MTU_SIZE) || (mtu > GATT_MAX_MTU_SIZE))
    {
        return GATT_ERROR;
        return GATT_ILLEGAL_PARAMETER;
    }

    if ( (p_tcb == NULL) || (p_reg==NULL) || (mtu < GATT_DEF_BLE_MTU_SIZE) || (mtu > GATT_MAX_MTU_SIZE))
    /* Validate that the link is BLE, not BR/EDR */
    if (p_tcb->transport != BT_TRANSPORT_LE)
    {
        return GATT_ILLEGAL_PARAMETER;
        return GATT_ERROR;
    }

    if (gatt_is_clcb_allocated(conn_id))