diff --git a/common/utils/oai_asn1.h b/common/utils/oai_asn1.h index 600aea1392..0f202bf699 100644 --- a/common/utils/oai_asn1.h +++ b/common/utils/oai_asn1.h @@ -154,17 +154,10 @@ static inline uint16_t BIT_STRING_to_uint16(const BIT_STRING_t *asn) { DevCheck ((asn->size > 0) && (asn->size <= 2), asn->size, 0, 0); - switch (asn->size) { - case 2: - result |= asn->buf[index++] << (8 - asn->bits_unused); - - case 1: - result |= asn->buf[index] >> asn->bits_unused; - break; - - default: - break; + if (asn->size == 2) { + result |= asn->buf[index++] << (8 - asn->bits_unused); } + result |= asn->buf[index] >> asn->bits_unused; return result; } diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c index 256dab11f7..5a7e9dddac 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c @@ -82,7 +82,7 @@ void nr_fill_sl_rx_indication(sl_nr_rx_indication_t *rx_ind, sl_nr_ssb_pdu_t *ssb_pdu = &rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu; if (typeSpecific) { uint8_t *psbch_decoded_output = (uint8_t *)typeSpecific; - memcpy(ssb_pdu->psbch_payload, psbch_decoded_output, sizeof(4)); // 4 bytes of PSBCH payload bytes + memcpy(ssb_pdu->psbch_payload, psbch_decoded_output, 4); // 4 bytes of PSBCH payload bytes ssb_pdu->rsrp_dbm = sl_phy_params->psbch.rsrp_dBm_per_RE; ssb_pdu->rx_slss_id = rx_slss_id; ssb_pdu->decode_status = true; diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index 9dd9ef61a9..8a77534f9a 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -463,7 +463,7 @@ int main(int argc, char **argv) s_im = malloc(n_tx*sizeof(double*)); r_re = malloc(n_rx*sizeof(double*)); r_im = malloc(n_rx*sizeof(double*)); - memcpy((void*)&gNB->frame_parms,(void*)frame_parms,sizeof(frame_parms)); + memcpy((void *)&gNB->frame_parms, (void *)frame_parms, sizeof(*frame_parms)); for (int aatx=0; aatxvalue.choice.Cause.present != E1AP_Cause_PR_NOTHING) && (ie->value.choice.Cause.present != E1AP_Cause_PR_choice_extension)) bearerCxt->cause = ie->value.choice.Cause.choice.radioNetwork; - + break; default: LOG_E(E1AP, "Handle for this IE is not implemented (or) invalid IE detected\n"); diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index de8fa49d48..3bc82305a6 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -1901,6 +1901,7 @@ static uint32_t nr_get_sf_periodicBSRTimer(long periodicBSR) break; case NR_BSR_Config__periodicBSR_Timer_infinity: timer = UINT_MAX; + break; default: AssertFatal(false, "Invalid periodicBSR_Timer %ld\n", periodicBSR); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 7f364235ad..e792da24ff 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -132,6 +132,7 @@ void clear_nr_nfapi_information(gNB_MAC_INST *gNB, } free(future_ul_tti_req->pdus_list[i].srs_pdu.beamforming.prgs_list); } + break; default: break; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 18ce58f2d4..8bc44122ab 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -386,7 +386,7 @@ static uint32_t schedule_control_sib1(module_id_t module_id, pdsch->mcs = 0; // starting from mcs 0 gNB_mac->sched_ctrlCommon->num_total_bytes = num_total_bytes; - uint8_t nr_of_candidates; + uint8_t nr_of_candidates = 0; for (int i=0; i<3; i++) { find_aggregation_candidates(&gNB_mac->sched_ctrlCommon->aggregation_level, &nr_of_candidates, gNB_mac->sched_ctrlCommon->search_space,4<destinationL2Id=destinationL2Id; } } /* end of !ctxt.enb_flag */ - + break; default: LOG_D(PDCP, "pc5s message type %d, unknown...\n", pc5s_header->traffic_type); break; diff --git a/openair2/M2AP/m2ap_MCE_interface_management.c b/openair2/M2AP/m2ap_MCE_interface_management.c index 9d45eac4a3..d6efcb105b 100644 --- a/openair2/M2AP/m2ap_MCE_interface_management.c +++ b/openair2/M2AP/m2ap_MCE_interface_management.c @@ -1376,7 +1376,7 @@ int MCE_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, module_id_t d /* mandatory */ /* c1. MCCH_Update_Time */ //long - ie=(M2AP_MbmsServiceCountingRequest_Ies_t *)calloc(1,sizeof(M2AP_MbmsSchedulingInformation_Ies_t)); + ie = calloc(1, sizeof(*ie)); ie->id = M2AP_ProtocolIE_ID_id_MCCH_Update_Time; ie->criticality = M2AP_Criticality_reject; ie->value.present = M2AP_MbmsServiceCountingRequest_Ies__value_PR_MCCH_Update_Time; @@ -1388,7 +1388,7 @@ int MCE_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, module_id_t d /* mandatory */ /* c1. MCE_MBMS_M2AP_ID (integer value) */ //long - ie = (M2AP_MbmsServiceCountingRequest_Ies_t *)calloc(1, sizeof(M2AP_MbmsServiceCountingRequest_Ies_t)); + ie = calloc(1, sizeof(*ie)); ie->id = M2AP_ProtocolIE_ID_id_MBSFN_Area_ID; ie->criticality = M2AP_Criticality_reject; ie->value.present = M2AP_MbmsServiceCountingRequest_Ies__value_PR_MBSFN_Area_ID; @@ -1397,7 +1397,7 @@ int MCE_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, module_id_t d /* mandatory */ /* c2. TMGI (integrer value) */ - ie = (M2AP_MbmsServiceCountingRequest_Ies_t *)calloc(1, sizeof(M2AP_MbmsServiceCountingRequest_Ies_t )); + ie = calloc(1, sizeof(*ie)); ie->id = M2AP_ProtocolIE_ID_id_MBMS_Counting_Request_Session; ie->criticality = M2AP_Criticality_reject; ie->value.present = M2AP_MbmsServiceCountingRequest_Ies__value_PR_MBMS_Counting_Request_Session; diff --git a/openair2/RRC/NR_UE/rrc_sl_preconfig.c b/openair2/RRC/NR_UE/rrc_sl_preconfig.c index b5ae64b96e..212899f866 100644 --- a/openair2/RRC/NR_UE/rrc_sl_preconfig.c +++ b/openair2/RRC/NR_UE/rrc_sl_preconfig.c @@ -215,7 +215,7 @@ static void prepare_NR_SL_BWPConfigCommon(NR_SL_BWP_ConfigCommon_r16_t *sl_bwp, // Value can be between symbols 0 to 7 sl_bwp->sl_BWP_Generic_r16->sl_StartSymbol_r16 = calloc(1, sizeof(long)); - sl_bwp->sl_BWP_Generic_r16->sl_PSBCH_Config_r16 = calloc(1,sizeof(NR_SL_PSBCH_Config_r16_t)); + sl_bwp->sl_BWP_Generic_r16->sl_PSBCH_Config_r16 = calloc(1, sizeof(*sl_bwp->sl_BWP_Generic_r16->sl_PSBCH_Config_r16)); // PSBCH CONFIG contains PO and alpha for PSBCH powercontrol. sl_bwp->sl_BWP_Generic_r16->sl_PSBCH_Config_r16->present = NR_SetupRelease_SL_PSBCH_Config_r16_PR_release;