From 4b859a2eb802ba8d40cf87605f950d0370771c18 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 26 Aug 2024 17:08:03 +0200 Subject: [PATCH] fix sidelink UE issues found by sanitizer --- executables/nr-ue.c | 4 ++-- openair2/LAYER2/NR_MAC_UE/mac_defs_sl.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index dca05ea36a..7d643e634e 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -802,7 +802,7 @@ void *UE_thread(void *arg) bool syncRunning = false; const int nb_slot_frame = fp->slots_per_frame; - int absolute_slot = 0, decoded_frame_rx = INT_MAX, trashed_frames = 0; + int absolute_slot = 0, decoded_frame_rx = MAX_FRAME_NUMBER - 1, trashed_frames = 0; int tx_wait_for_dlsch[NR_MAX_SLOTS_PER_FRAME]; int num_ind_fifo = nb_slot_frame; @@ -897,7 +897,7 @@ void *UE_thread(void *arg) ""); // we have the decoded frame index in the return of the synch process // and we shifted above to the first slot of next frame - decoded_frame_rx++; + decoded_frame_rx = (decoded_frame_rx + 1) % MAX_FRAME_NUMBER; // we do ++ first in the regular processing, so it will be begin of frame; absolute_slot = decoded_frame_rx * nb_slot_frame - 1; if (UE->sl_mode == 2) { diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs_sl.h b/openair2/LAYER2/NR_MAC_UE/mac_defs_sl.h index 5960a30a46..10eaea3862 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs_sl.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs_sl.h @@ -120,9 +120,9 @@ typedef struct sl_bch_params { //configured from RRC //Parameters used to determine PSBCH slot sl_ssb_timealloc_t ssb_time_alloc; + uint8_t sl_mib[4] __attribute__((aligned(4))); uint16_t slss_id; bool status; - uint8_t sl_mib[4]; //Parameters incremented by MAC PSBCH scheduler //after every SSB txn/reception