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.
This commit is contained in:
Robert Schmidt
2024-11-15 15:37:03 +01:00
parent f54ca5714e
commit a319cbfb19
2 changed files with 2 additions and 2 deletions
@@ -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;
@@ -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;