Skip to content

Commit 31f7f82

Browse files
nimble/ll: Fix unaligned access in addr resolver
ble_ll_resolv_rpa() casts IRK parameter to uint32_t* for faster access, but this parameter is a pointer to member of struct ble_ll_resolv_entry which is not word aligned thus it will hardfault on cm0. This patch forces proper aligmnent of IRKs.
1 parent 766a414 commit 31f7f82

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

nimble/controller/include/controller/ble_ll_resolv.h

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct ble_ll_resolv_entry
3535
uint8_t rl_addr_type;
3636
uint8_t rl_reserved;
3737
uint8_t rl_priv_mode;
38+
uint8_t _pad;
3839
uint8_t rl_local_irk[16];
3940
uint8_t rl_peer_irk[16];
4041
uint8_t rl_identity_addr[BLE_DEV_ADDR_LEN];

nimble/controller/src/ble_ll_resolv.c

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct ble_ll_resolv_data
4343
};
4444
struct ble_ll_resolv_data g_ble_ll_resolv_data;
4545

46+
__attribute__((aligned(4)))
4647
struct ble_ll_resolv_entry g_ble_ll_resolv_list[MYNEWT_VAL(BLE_LL_RESOLV_LIST_SIZE)];
4748

4849
static int

0 commit comments

Comments
 (0)