mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccoll...@apache.org
Subject [45/50] [abbrv] incubator-mynewt-core git commit: BLE Host - BLE_HS_EMSGSIZE used incorrectly.
Date Fri, 08 Jul 2016 21:20:32 GMT
BLE Host - BLE_HS_EMSGSIZE used incorrectly.

For many HCI events, BLE_HS_EMSGSIZE was used when the event's length
was unexpected.  The correct error code to use in this case is
BLE_HS_ECONTROLLER.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/41291575
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/41291575
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/41291575

Branch: refs/heads/master
Commit: 41291575c8a4b74a215a46a01fd2ae093fd6d7c5
Parents: dda1c9a
Author: Christopher Collins <ccollins@apache.org>
Authored: Sat Jul 2 19:50:15 2016 -0700
Committer: Christopher Collins <ccollins@apache.org>
Committed: Sat Jul 2 19:50:15 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/src/ble_hci_cmd.c |  6 +++---
 net/nimble/host/src/host_hci.c    | 24 ++++++++++++------------
 2 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/41291575/net/nimble/host/src/ble_hci_cmd.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hci_cmd.c b/net/nimble/host/src/ble_hci_cmd.c
index 0e14f04..23eaba3 100644
--- a/net/nimble/host/src/ble_hci_cmd.c
+++ b/net/nimble/host/src/ble_hci_cmd.c
@@ -70,7 +70,7 @@ ble_hci_cmd_rx_cmd_complete(uint8_t event_code, uint8_t *data, int len,
 
     if (len < BLE_HCI_EVENT_CMD_COMPLETE_HDR_LEN) {
         /* XXX: Increment stat. */
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_ECONTROLLER;
     }
 
     num_pkts = data[2];
@@ -113,7 +113,7 @@ ble_hci_cmd_rx_cmd_status(uint8_t event_code, uint8_t *data, int len,
 
     if (len < BLE_HCI_EVENT_CMD_STATUS_LEN) {
         /* XXX: Increment stat. */
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_ECONTROLLER;
     }
 
     status = data[2];
@@ -182,7 +182,7 @@ ble_hci_cmd_process_ack(uint8_t *params_buf, uint8_t params_buf_len,
         } else {
             if (out_ack->bha_params_len > params_buf_len) {
                 out_ack->bha_params_len = params_buf_len;
-                rc = BLE_HS_EMSGSIZE;
+                rc = BLE_HS_ECONTROLLER;
             }
             memcpy(params_buf, out_ack->bha_params, out_ack->bha_params_len);
         }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/41291575/net/nimble/host/src/host_hci.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/host_hci.c b/net/nimble/host/src/host_hci.c
index 5f58663..4452dcc 100644
--- a/net/nimble/host/src/host_hci.c
+++ b/net/nimble/host/src/host_hci.c
@@ -151,7 +151,7 @@ host_hci_rx_disconn_complete(uint8_t event_code, uint8_t *data, int len)
     struct hci_disconn_complete evt;
 
     if (len < BLE_HCI_EVENT_DISCONN_COMPLETE_LEN) {
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_ECONTROLLER;
     }
 
     evt.status = data[2];
@@ -208,14 +208,14 @@ host_hci_rx_num_completed_pkts(uint8_t event_code, uint8_t *data, int
len)
     int i;
 
     if (len < BLE_HCI_EVENT_HDR_LEN + BLE_HCI_EVENT_NUM_COMP_PKTS_HDR_LEN) {
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_ECONTROLLER;
     }
 
     off = BLE_HCI_EVENT_HDR_LEN;
     num_handles = data[off];
     if (len < BLE_HCI_EVENT_NUM_COMP_PKTS_HDR_LEN +
               num_handles * BLE_HCI_EVENT_NUM_COMP_PKTS_ENT_LEN) {
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_ECONTROLLER;
     }
     off++;
 
@@ -240,7 +240,7 @@ host_hci_rx_le_meta(uint8_t event_code, uint8_t *data, int len)
 
     if (len < BLE_HCI_EVENT_HDR_LEN + BLE_HCI_LE_MIN_LEN) {
         /* XXX: Increment stat. */
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_ECONTROLLER;
     }
 
     subevent = data[2];
@@ -264,13 +264,13 @@ host_hci_rx_le_conn_complete(uint8_t subevent, uint8_t *data, int len)
     int rc;
 
     if (len < BLE_HCI_LE_CONN_COMPLETE_LEN) {
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_ECONTROLLER;
     }
 
     /* this code processes two different events that are really similar */
     if ((subevent == BLE_HCI_LE_SUBEV_ENH_CONN_COMPLETE) &&
         ( len < BLE_HCI_LE_ENH_CONN_COMPLETE_LEN)) {
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_ECONTROLLER;
     }
 
     evt.subevent_code = data[0];
@@ -322,7 +322,7 @@ host_hci_le_adv_rpt_first_pass(uint8_t *data, int len,
     int i;
 
     if (len < BLE_HCI_LE_ADV_RPT_MIN_LEN) {
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_ECONTROLLER;
     }
 
     num_reports = data[1];
@@ -338,7 +338,7 @@ host_hci_le_adv_rpt_first_pass(uint8_t *data, int len,
            6        /* Address. */
           ) * num_reports;
     if (off + num_reports >= len) {
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_ECONTROLLER;
     }
 
     data_len = 0;
@@ -351,7 +351,7 @@ host_hci_le_adv_rpt_first_pass(uint8_t *data, int len,
 
     /* Check if RSSI fields fit in the packet. */
     if (off + num_reports > len) {
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_ECONTROLLER;
     }
 
     *out_num_reports = num_reports;
@@ -409,7 +409,7 @@ host_hci_rx_le_conn_upd_complete(uint8_t subevent, uint8_t *data, int
len)
     struct hci_le_conn_upd_complete evt;
 
     if (len < BLE_HCI_LE_CONN_UPD_LEN) {
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_ECONTROLLER;
     }
 
     evt.subevent_code = data[0];
@@ -467,7 +467,7 @@ host_hci_rx_le_conn_parm_req(uint8_t subevent, uint8_t *data, int len)
     struct hci_le_conn_param_req evt;
 
     if (len < BLE_HCI_LE_REM_CONN_PARM_REQ_LEN) {
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_ECONTROLLER;
     }
 
     evt.subevent_code = data[0];
@@ -615,7 +615,7 @@ host_hci_data_hdr_strip(struct os_mbuf *om, struct hci_data_hdr *hdr)
 
     rc = os_mbuf_copydata(om, 0, BLE_HCI_DATA_HDR_SZ, hdr);
     if (rc != 0) {
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_ECONTROLLER;
     }
 
     /* Strip HCI ACL data header from the front of the packet. */


Mime
View raw message