Skip to content

Commit ecc2103

Browse files
committed
sched: fix malloc in pucch_allocator
Signed-off-by: Carlo Galiotto <[email protected]>
1 parent 7afffe4 commit ecc2103

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/scheduler/pucch_scheduling/pucch_allocator_impl.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,9 @@ pucch_allocator_impl::multiplex_resources(slot_point sl_tx,
18911891
// slot without repetitions where".
18921892
pucch_grant_list mplexed_grants;
18931893

1894-
std::vector<pucch_grant> resource_set_q;
1894+
// The vector should contain at most 1 HARQ-ACK grant, 1 SR grant, 1 CSI grant.
1895+
static constexpr size_t max_nof_grant = 3;
1896+
static_vector<pucch_grant, max_nof_grant> resource_set_q;
18951897

18961898
// Build the resource set Q. Refer to Section 9.2.5, TS 38.213.
18971899
if (candidate_grants.harq_resource.has_value()) {
@@ -1940,6 +1942,7 @@ pucch_allocator_impl::multiplex_resources(slot_point sl_tx,
19401942
resource_set_q.erase(resource_set_q.begin() + j_cnt - o_cnt, resource_set_q.begin() + j_cnt + 1);
19411943

19421944
// Add the new resource (resulting from the previous merge) to the set.
1945+
srsran_assert(not resource_set_q.full(), "PUCCH resource_set_q is full before adding a new resource");
19431946
resource_set_q.push_back(new_res.value());
19441947

19451948
// Sort the resources in the set based on the first symbol position and number of symbols.

0 commit comments

Comments
 (0)