From 1e6c36d8770911ef8ab8ff23d066c0f13c771e9d Mon Sep 17 00:00:00 2001 From: francescomani <francesco.mani@eurecom.fr> Date: Mon, 1 Nov 2021 12:03:25 +0100 Subject: [PATCH] fix segfault in SA rfsim --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 9d9e456c143..ad98198908e 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -496,14 +496,18 @@ void config_bwp_ue(NR_UE_MAC_INST_t *mac, uint16_t *bwp_ind, uint8_t *dci_format NR_ServingCellConfig_t *scd = mac->cg->spCellConfig->spCellConfigDedicated; - if (bwp_ind && dci_format){ + int n_ubwp = 0; + if (scd && scd->uplinkConfig && + scd->uplinkConfig->uplinkBWP_ToAddModList) + n_ubwp = scd->uplinkConfig->uplinkBWP_ToAddModList->list.count; + if (bwp_ind && dci_format){ switch(*dci_format){ case NR_UL_DCI_FORMAT_0_1: - mac->UL_BWP_Id = *bwp_ind +1 ; + mac->UL_BWP_Id = n_ubwp < 4 ? *bwp_ind : *bwp_ind + 1;; break; case NR_DL_DCI_FORMAT_1_1: - mac->DL_BWP_Id = *bwp_ind +1; + mac->DL_BWP_Id = n_ubwp < 4 ? *bwp_ind : *bwp_ind + 1;; break; default: LOG_E(MAC, "In %s: failed to configure BWP Id from DCI with format %d \n", __FUNCTION__, *dci_format); -- GitLab