mirror of https://github.com/PentHertz/srsLTE.git
Fixes coverity 370816
This commit is contained in:
parent
0fdbfcffd0
commit
6cd917fca5
|
@ -182,8 +182,16 @@ private:
|
||||||
/// TS 36.321, Table 7.2.2-2
|
/// TS 36.321, Table 7.2.2-2
|
||||||
static uint32_t nof_bandwidth_parts(uint32_t nof_prb)
|
static uint32_t nof_bandwidth_parts(uint32_t nof_prb)
|
||||||
{
|
{
|
||||||
|
static const uint32_t nrb_size = 6u;
|
||||||
static const uint32_t nrb[] = {0, 2, 2, 3, 4, 4};
|
static const uint32_t nrb[] = {0, 2, 2, 3, 4, 4};
|
||||||
return nrb[srsran::lte_cell_nof_prb_to_index(nof_prb)];
|
uint32_t index = srsran::lte_cell_nof_prb_to_index(nof_prb);
|
||||||
|
|
||||||
|
srsran_assert(index < nrb_size, "nrb index out of bounds");
|
||||||
|
|
||||||
|
// Fix error out of bounds, returns the array's first element by default.
|
||||||
|
index = (index < nrb_size) ? index : 0;
|
||||||
|
|
||||||
|
return nrb[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t J() const { return nof_bandwidth_parts(); }
|
uint32_t J() const { return nof_bandwidth_parts(); }
|
||||||
|
|
Loading…
Reference in New Issue