From 8da4373d30351aa1eace3245a1fabf7a3189558c Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Tue, 30 Jan 2018 17:33:20 +0100 Subject: [PATCH] fix various coverity bugs --- lib/examples/pdsch_enodeb.c | 4 ++-- lib/src/phy/fec/turbodecoder_simd.c | 2 +- lib/src/phy/fec/turbodecoder_sse_inter.c | 4 ++++ lib/src/phy/phch/ra.c | 2 +- srsenb/src/mac/scheduler_ue.cc | 1 + 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/examples/pdsch_enodeb.c b/lib/examples/pdsch_enodeb.c index dafff03b9..2f0f4836f 100644 --- a/lib/examples/pdsch_enodeb.c +++ b/lib/examples/pdsch_enodeb.c @@ -528,9 +528,9 @@ int update_radl() { srslte_ra_pdsch_fprint(stdout, &ra_dl, cell.nof_prb); srslte_ra_dl_grant_t dummy_grant; - srslte_ra_nbits_t dummy_nbits; + srslte_ra_nbits_t dummy_nbits[SRSLTE_MAX_CODEWORDS]; srslte_ra_dl_dci_to_grant(&ra_dl, cell.nof_prb, UE_CRNTI, &dummy_grant); - srslte_ra_dl_grant_to_nbits(&dummy_grant, cfi, cell, 0, &dummy_nbits); + srslte_ra_dl_grant_to_nbits(&dummy_grant, cfi, cell, 0, dummy_nbits); srslte_ra_dl_grant_fprint(stdout, &dummy_grant); dummy_grant.sf_type = SRSLTE_SF_NORM; if (pdsch_cfg.mimo_type != SRSLTE_MIMO_TYPE_SINGLE_ANTENNA) { diff --git a/lib/src/phy/fec/turbodecoder_simd.c b/lib/src/phy/fec/turbodecoder_simd.c index a32d52962..d8a5c1716 100644 --- a/lib/src/phy/fec/turbodecoder_simd.c +++ b/lib/src/phy/fec/turbodecoder_simd.c @@ -133,7 +133,7 @@ void map_simd_dec(map_gen_t * h, int16_t * input[SRSLTE_TDEC_MAX_NPAR], int16_t { uint32_t nof_cb = 1; - int16_t *outptr[SRSLTE_TDEC_MAX_NPAR]; + int16_t *outptr[SRSLTE_TDEC_MAX_NPAR] = { NULL, NULL }; // Compute branch metrics switch(cb_mask) { diff --git a/lib/src/phy/fec/turbodecoder_sse_inter.c b/lib/src/phy/fec/turbodecoder_sse_inter.c index bb1168368..d75c8a649 100644 --- a/lib/src/phy/fec/turbodecoder_sse_inter.c +++ b/lib/src/phy/fec/turbodecoder_sse_inter.c @@ -85,6 +85,10 @@ void map_sse_inter_beta(srslte_tdec_simd_inter_t * s, int16_t *input, int16_t *p __m128i *outputPtr = (__m128i*) output; __m128i *alphaPtr = (__m128i*) s->alpha; + for (int i = 0; i < 8; i++) { + old[i] = _mm_set1_epi16(0); + } + for (int k = end - 1; k >= 0; k--) { x = _mm_load_si128(inputPtr++); y = _mm_load_si128(parityPtr++); diff --git a/lib/src/phy/phch/ra.c b/lib/src/phy/phch/ra.c index e1eaa5de2..7107ab2f6 100644 --- a/lib/src/phy/phch/ra.c +++ b/lib/src/phy/phch/ra.c @@ -555,7 +555,7 @@ static int dl_dci_to_grant_mcs(srslte_ra_dl_dci_t *dci, srslte_ra_dl_grant_t *gr } void srslte_ra_dl_grant_to_nbits(srslte_ra_dl_grant_t *grant, uint32_t cfi, srslte_cell_t cell, uint32_t sf_idx, - srslte_ra_nbits_t nbits [SRSLTE_MAX_CODEWORDS]) + srslte_ra_nbits_t nbits[SRSLTE_MAX_CODEWORDS]) { // Compute number of RE for (int i = 0; i < SRSLTE_MAX_TB; i++) { diff --git a/srsenb/src/mac/scheduler_ue.cc b/srsenb/src/mac/scheduler_ue.cc index eb8f2459f..0c89f9728 100644 --- a/srsenb/src/mac/scheduler_ue.cc +++ b/srsenb/src/mac/scheduler_ue.cc @@ -212,6 +212,7 @@ bool sched_ue::pucch_sr_collision(uint32_t current_tti, uint32_t n_cce) return false; } srslte_pucch_sched_t pucch_sched; + pucch_sched.sps_enabled = false; pucch_sched.n_pucch_sr = cfg.sr_N_pucch; pucch_sched.n_pucch_2 = cfg.n_pucch_cqi; pucch_sched.N_pucch_1 = cfg.pucch_cfg.n1_pucch_an;