Return in nr_ue_get_sdu when mac->lc_ordered_list.count is 0

This count is used to size the dynamic array lcids_bj_pos. In case
count is zero, this would lead to runtime error. With this change,
the function will indicate to the caller that no SDUs are present and
will print an error.
This commit is contained in:
Guido Casati
2025-06-09 20:12:12 +02:00
parent de0730a4e8
commit 9d951b109f
@@ -2703,6 +2703,10 @@ static uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac,
mac->lc_ordered_list.count);
// variable used to build the lcids with positive Bj
if (!mac->lc_ordered_list.count) {
LOG_E(NR_MAC, "Failed to init lcids_bj_pos: mac->lc_ordered_list.count = 0\n");
return 0;
}
nr_lcordered_info_t lcids_bj_pos[mac->lc_ordered_list.count];
int avail_lcids_count = select_logical_channels(mac, lcids_bj_pos);