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

Commit 7645a788 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allocate buffers of the right size when BT_HDR is included" into mnc-dev

parents c497197d fedd8da9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1321,7 +1321,7 @@ UINT16 AVDT_SendReport(UINT8 handle, AVDT_REPORT_TYPE type,
        /* build SR - assume fit in one packet */
        p_tbl = avdt_ad_tc_tbl_by_type(AVDT_CHAN_REPORT, p_scb->p_ccb, p_scb);
        if((p_tbl->state == AVDT_AD_ST_OPEN) &&
            (p_pkt = (BT_HDR *)GKI_getbuf(p_tbl->peer_mtu)) != NULL)
            (p_pkt = (BT_HDR *)GKI_getbuf(p_tbl->peer_mtu + sizeof(BT_HDR))) != NULL)
        {
            p_pkt->offset = L2CAP_MIN_OFFSET;
            p = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
+1 −1
Original line number Diff line number Diff line
@@ -565,7 +565,7 @@ static void bnep_data_ind (UINT16 l2cap_cid, BT_HDR *p_buf)
            p_bcb->con_state != BNEP_STATE_CONNECTED &&
            extension_present && p && rem_len)
        {
            p_bcb->p_pending_data = (BT_HDR *)GKI_getbuf (rem_len);
            p_bcb->p_pending_data = (BT_HDR *)GKI_getbuf (rem_len + sizeof(BT_HDR));
            if (p_bcb->p_pending_data)
            {
                memcpy ((UINT8 *)(p_bcb->p_pending_data + 1), p, rem_len);
+4 −2
Original line number Diff line number Diff line
@@ -372,7 +372,8 @@ static void fragment_packet(l2cap_client_t *client, buffer_t *packet) {
  assert(packet != NULL);

  // TODO(sharvil): eliminate copy into BT_HDR.
  BT_HDR *bt_packet = GKI_getbuf(buffer_length(packet) + L2CAP_MIN_OFFSET);
  BT_HDR *bt_packet = GKI_getbuf(buffer_length(packet) + L2CAP_MIN_OFFSET +
                                 sizeof(BT_HDR));
  bt_packet->offset = L2CAP_MIN_OFFSET;
  bt_packet->len = buffer_length(packet);
  memcpy(bt_packet->data + bt_packet->offset, buffer_ptr(packet), buffer_length(packet));
@@ -386,7 +387,8 @@ static void fragment_packet(l2cap_client_t *client, buffer_t *packet) {
      break;
    }

    BT_HDR *fragment = GKI_getbuf(client->remote_mtu + L2CAP_MIN_OFFSET);
    BT_HDR *fragment = GKI_getbuf(client->remote_mtu + L2CAP_MIN_OFFSET +
                                  sizeof(BT_HDR));
    fragment->offset = L2CAP_MIN_OFFSET;
    fragment->len = client->remote_mtu;
    memcpy(fragment->data + fragment->offset, bt_packet->data + bt_packet->offset, client->remote_mtu);
+3 −3
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ void mca_ccb_snd_req(tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data)
        p_ccb->p_tx_req = p_msg;
        if (!p_ccb->cong)
        {
            p_pkt = (BT_HDR *)GKI_getbuf (MCA_CTRL_MTU);
            p_pkt = (BT_HDR *)GKI_getbuf (MCA_CTRL_MTU + sizeof(BT_HDR));
            if (p_pkt)
            {
                p_pkt->offset = L2CAP_MIN_OFFSET;
@@ -168,7 +168,7 @@ void mca_ccb_snd_rsp(tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data)

    MCA_TRACE_DEBUG ("mca_ccb_snd_rsp cong=%d req=%d", p_ccb->cong, p_msg->op_code);
    /* assume that API functions verified the parameters */
    p_pkt = (BT_HDR *)GKI_getbuf (MCA_CTRL_MTU);
    p_pkt = (BT_HDR *)GKI_getbuf (MCA_CTRL_MTU + sizeof(BT_HDR));
    if (p_pkt)
    {
        p_pkt->offset = L2CAP_MIN_OFFSET;
@@ -409,7 +409,7 @@ void mca_ccb_hdl_req(tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data)
    if (((reject_code != MCA_RSP_SUCCESS) && (evt_data.hdr.op_code != MCA_OP_SYNC_INFO_IND))
        || send_rsp)
    {
        p_buf = (BT_HDR *)GKI_getbuf (MCA_CTRL_MTU);
        p_buf = (BT_HDR *)GKI_getbuf (MCA_CTRL_MTU + sizeof(BT_HDR));
        if (p_buf)
        {
            p_buf->offset = L2CAP_MIN_OFFSET;