From a319cbfb19da524deb9be61b5c608104181cb1bf Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 14 Nov 2024 14:38:22 +0100 Subject: [PATCH] Prevent segfault when trying to schedule MAX_MOBILES_PER_GNB UEs When the UE list is full, the iterator will run through all MAX_MOBILES_PER_GNB UEs. It expects that eventually the pointer is NULL, which is not the case if we have MAX_MOBILES_PER_GNB (or it simply depends on the following memory). So give one array entry more, to ensure that the last one is NULL. --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 82106d0ef2..4022476ac6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -613,7 +613,7 @@ static void pf_dl(module_id_t module_id, gNB_MAC_INST *mac = RC.nrmac[module_id]; NR_ServingCellConfigCommon_t *scc=mac->common_channels[0].ServingCellConfigCommon; // UEs that could be scheduled - UEsched_t UE_sched[MAX_MOBILES_PER_GNB] = {0}; + UEsched_t UE_sched[MAX_MOBILES_PER_GNB + 1] = {0}; int remainUEs = max_num_ue; int curUE = 0; int CC_id = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 4c0d40d24f..8a38c6e66d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1790,7 +1790,7 @@ static void pf_ul(module_id_t module_id, const int min_rb = nrmac->min_grant_prb; // UEs that could be scheduled - UEsched_t UE_sched[MAX_MOBILES_PER_GNB] = {0}; + UEsched_t UE_sched[MAX_MOBILES_PER_GNB + 1] = {0}; int remainUEs = max_num_ue; int curUE = 0;