Skip to content

Commit 6937db8

Browse files
carlo-galcodebot
authored andcommitted
sched: fix pucch res mng span indexing
Signed-off-by: Carlo Galiotto <[email protected]>
1 parent b2b55b5 commit 6937db8

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

lib/scheduler/pucch_scheduling/pucch_resource_manager.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,11 @@ pucch_harq_resource_alloc_record pucch_resource_manager::reserve_next_harq_res_a
334334
const unsigned res_set_idx = format == pucch_format::FORMAT_1 ? PUCCH_HARQ_F1_RES_SET_ID : PUCCH_HARQ_F2_RES_SET_ID;
335335

336336
// Get the span over the array of resources for the specific UE.
337-
const auto& ue_res_id_set_for_harq = pucch_cfg.pucch_res_set[res_set_idx].pucch_res_id_list;
338-
unsigned ue_first_f1_res_id = ue_res_id_set_for_harq.front();
339-
span<resource_tracker> slot_ue_res_array(&slot_res_array[ue_first_f1_res_id], slot_res_array.size());
337+
const auto& ue_res_id_set_for_harq = pucch_cfg.pucch_res_set[res_set_idx].pucch_res_id_list;
338+
unsigned ue_first_res_id = ue_res_id_set_for_harq.front();
339+
srsran_assert(ue_first_res_id + ue_res_id_set_for_harq.size() <= slot_res_array.size(),
340+
"Indexing of PUCCH resource set exceeds the size of the cell resource array");
341+
span<resource_tracker> slot_ue_res_array(&slot_res_array[ue_first_res_id], ue_res_id_set_for_harq.size());
340342

341343
// Check first if there is any PUCCH resource is available.
342344
auto* available_resource = std::find_if(slot_ue_res_array.begin(),
@@ -391,9 +393,11 @@ bool pucch_resource_manager::release_harq_resource(slot_point slot_harq
391393
format == pucch_format::FORMAT_1 ? pucch_resource_usage::HARQ_F1 : pucch_resource_usage::HARQ_F2;
392394

393395
// Get the span over the array of resources for the specific UE.
394-
const auto& ue_res_id_set_for_harq = pucch_cfg.pucch_res_set[res_set_idx].pucch_res_id_list;
395-
unsigned ue_first_f1_res_id = ue_res_id_set_for_harq.front();
396-
span<resource_tracker> slot_ue_res_array(&slot_res_array[ue_first_f1_res_id], slot_res_array.size());
396+
const auto& ue_res_id_set_for_harq = pucch_cfg.pucch_res_set[res_set_idx].pucch_res_id_list;
397+
unsigned ue_first_res_id = ue_res_id_set_for_harq.front();
398+
srsran_assert(ue_first_res_id + ue_res_id_set_for_harq.size() <= slot_res_array.size(),
399+
"Indexing of PUCCH resource set exceeds the size of the cell resource array");
400+
span<resource_tracker> slot_ue_res_array(&slot_res_array[ue_first_res_id], ue_res_id_set_for_harq.size());
397401

398402
// Check first if the target PUCCH resource (given the CRNTI and usage) exists within the resource tracker.
399403
auto* target_res =
@@ -431,9 +435,11 @@ int pucch_resource_manager::fetch_pucch_res_indic(slot_point slot_tx,
431435
format == pucch_format::FORMAT_1 ? pucch_resource_usage::HARQ_F1 : pucch_resource_usage::HARQ_F2;
432436

433437
// Get the span over the array of resources for the specific UE.
434-
const auto& ue_res_id_set_for_harq = pucch_cfg.pucch_res_set[res_set_idx].pucch_res_id_list;
435-
unsigned ue_first_f1_res_id = ue_res_id_set_for_harq.front();
436-
span<resource_tracker> slot_ue_res_array(&slot_res_array[ue_first_f1_res_id], slot_res_array.size());
438+
const auto& ue_res_id_set_for_harq = pucch_cfg.pucch_res_set[res_set_idx].pucch_res_id_list;
439+
unsigned ue_first_res_id = ue_res_id_set_for_harq.front();
440+
srsran_assert(ue_first_res_id + ue_res_id_set_for_harq.size() <= slot_res_array.size(),
441+
"Indexing of PUCCH resource set exceeds the size of the cell resource array");
442+
span<resource_tracker> slot_ue_res_array(&slot_res_array[ue_first_res_id], ue_res_id_set_for_harq.size());
437443

438444
// Check first if the target PUCCH resource (given the CRNTI and usage) exists within the resource tracker.
439445
auto* ue_resource = std::find_if(

0 commit comments

Comments
 (0)