diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-01-14 12:12:43 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-01-14 12:12:45 +0100 |
commit | 54faf023be0e8f9bcfdb64fd0afb3a00138cd45f (patch) | |
tree | 92516f6860837b7cb4bc247a09f1e38da4c12cfb /src/pcu_l1_if.cpp | |
parent | f842e06c88027ed6ccf5a791d6691228b858fd56 (diff) |
Workaround ASan false positive runtime errors under some platforms
Under some platforms (RPI4, ARM) container older ASan, it will log false
positive log errors which will make unit test fail because then output
changes:
"""
pcu_l1_if.cpp:847:2: runtime error: member access within misaligned address 0xb3f0b78c for type 'struct GprsMs', which requires 8 byte alignment
"""
The pointer is indeed misaligned, but it's not actually a bug, because
the pointer is never derreferenced. That happens during
llist_for_each_entry operation where it does cast the pointer but it
only checks if the list has actually reached the end.
To workaround the issue, simply defer casting it by using llist_for_each
instead, where the pointer is assigned only in the case it really points
to a GprsMS struct.
Change-Id: I149fb42706501eb33f9c6fe48f76a03ddee5954a
Diffstat (limited to 'src/pcu_l1_if.cpp')
-rw-r--r-- | src/pcu_l1_if.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index 9cc62708..2aea00b4 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -840,15 +840,16 @@ static int pcu_rx_susp_req(struct gsm_pcu_if_susp_req *susp_req) static int pcu_rx_app_info_req(struct gsm_pcu_if_app_info_req *app_info_req) { - GprsMs *ms; BTS *bts = BTS::main_bts(); struct gprs_rlcmac_bts *bts_data = bts->bts_data(); + struct llist_head *tmp; LOGP(DL1IF, LOGL_DEBUG, "Application Information Request received: type=0x%08x len=%i\n", app_info_req->application_type, app_info_req->len); bts_data->app_info_pending = 0; - llist_for_each_entry(ms, bts->ms_store().ms_list(), list) { + llist_for_each(tmp, bts->ms_store().ms_list()) { + GprsMs *ms = llist_entry(tmp, typeof(*ms), list); if (!ms_dl_tbf(ms)) continue; bts_data->app_info_pending++; |