diff --git a/ci-scripts/cppcheck_suppressions.list b/ci-scripts/cppcheck_suppressions.list index beae4e11e7a0243ecdc18feb7880528b90888724..d5aea7ae9d76b0230c9a8252d0653ee0e25876ae 100644 --- a/ci-scripts/cppcheck_suppressions.list +++ b/ci-scripts/cppcheck_suppressions.list @@ -33,7 +33,7 @@ memleak:common/utils/hashtable/obj_hashtable.c // suppress error about keys memory leak, free must be done by calling func memleak:openair2/UTIL/OMG/omg_hashtable.c //----------------------------------------------------------------------------- -// suppress error about data memory leak. This is the buffer where +// suppress error about data memory leak. This is the buffer where // _emm_as_encode function creates the encoded buffer // memleak:openair3/NAS/UE/EMM/SAP/emm_as.c diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c index c180b5b0f9cfa24ae620950e19548d2b99387f3b..6fe9b47409b1108e11adee776540b1d5cec4506f 100644 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c @@ -1545,7 +1545,7 @@ static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, // DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0) int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end); - if (0 && pdu->segments[j].segment_length == 3) + if (pdu->segments[j].segment_length == 3) { NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, pdu->segments[j].segment_data[0], @@ -4429,40 +4429,43 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void * for(i = 0; i < totalNumPdus; ++i) { nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]); + if (pdu) { + uint16_t length = 0; + uint16_t index = 0; - uint16_t length = 0; - uint16_t index = 0; - - if(!(pull16(ppReadPackedMsg, &length, end) && + if(!(pull16(ppReadPackedMsg, &length, end) && pull16(ppReadPackedMsg, &index, end))) - return 0; + return 0; - pdu->pdu_length = length; - pdu->pdu_index = index; + pdu->pdu_length = length; + pdu->pdu_index = index; // TODO : May need to rethink this bit - pdu->num_segments = 1; - pdu->segments[0].segment_length = pdu->pdu_length; - pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config); + pdu->num_segments = 1; + pdu->segments[0].segment_length = pdu->pdu_length; + pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config); - if(pdu->segments[0].segment_data) - { - if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end)) + if(pdu->segments[0].segment_data) + { + if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end)) return 0; - if (0 && pdu->segments[0].segment_length == 3) - { + if (pdu->segments[0].segment_length == 3) + { NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, pdu->segments[0].segment_data[0], pdu->segments[0].segment_data[1], pdu->segments[0].segment_data[2] ); - } - } - else - { + } + } + else + { NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index); - } + } + } else { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n"); + } } } break; diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index fbd6d79fe26c9e25e61cb5ee52fa1e000d56d3d3..2902e6f57b0c8d7c49d107d35c576afa9afb8687 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -1902,7 +1902,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin if ((frame_parms->frame_type==FDD) || (bundling_flag==bundling) || - ((frame_parms->frame_type==TDD)&&(frame_parms->tdd_config==1)&&((subframe_tx!=2)||(subframe_tx!=7)))) { + ((frame_parms->frame_type==TDD)&&(frame_parms->tdd_config==1)&&((subframe_tx==2)||(subframe_tx==7)))) { format = pucch_format1a; // LOG_D(PHY,"[UE] PUCCH 1a\n"); } else { diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 2b2922597760bfa138c58cf2bc830ccb6e238234..0c17e21acc647ea7489860fed86e7fd73a3ffd22 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -1047,7 +1047,7 @@ int main(int argc, char **argv) { sigma2_dB = N0;//-10*log10(UE->frame_parms.ofdm_symbol_size/(UE->frame_parms.N_RB_DL*12));//10*log10((double)tx_lev) +10*log10(UE->frame_parms.ofdm_symbol_size/(UE->frame_parms.N_RB_DL*12)) - SNR; sigma2 = pow(10,sigma2_dB/10); // compute tx_gain to achieve target SNR (per resource element!) - tx_gain = sqrt(pow(10.0,.1*(N0+SNR))/(double)tx_lev);//*(nb_rb*12/(double)UE->frame_parms.ofdm_symbol_size)/(double)tx_lev); + tx_gain = sqrt(pow(10.0,.1*(N0+SNR))/(double)tx_lev);// *(nb_rb*12/(double)UE->frame_parms.ofdm_symbol_size)/(double)tx_lev); if (n_frames==1) printf("tx_lev = %u (%u.%u dB,%f), gain %f\n",tx_lev,tx_lev_dB/10,tx_lev_dB,10*log10((double)tx_lev),10*log10(tx_gain)); @@ -1212,7 +1212,8 @@ int main(int argc, char **argv) { dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round); - if (round == 4) exit(-1); + round=5; + } if (n_frames==1) printf("round %d errors %u/%u\n",round,errs[round],trials); diff --git a/openair1/SIMULATION/TOOLS/abstraction.c b/openair1/SIMULATION/TOOLS/abstraction.c index 832ba82186cac15840fba1494b76ac43eba3be7d..7ac19804176115087bb1db54b803543bd20a7bf9 100644 --- a/openair1/SIMULATION/TOOLS/abstraction.c +++ b/openair1/SIMULATION/TOOLS/abstraction.c @@ -254,7 +254,7 @@ void load_pbch_desc(FILE *pbch_file_fd) { printf("PBCH polynomial : "); for (i=0; i<=pbch_polynomial_degree; i++) { - ret = fscanf(pbch_file_fd,"%s",dummy); + ret = fscanf(pbch_file_fd,"%24s",dummy); if (ret < 0) { printf("fscanf failed: %s\n", strerror(errno)); diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c index e874f94840409ec1016459e1ce3f223093886e24..7a95a62787a58c65e114ca76bf4723e2c9c15ade 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c @@ -532,7 +532,7 @@ void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma if (tb_src != NULL) { tb_size = ((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits >> 3; - printf("[RLC-LOOP] FOUND TB SIZE IN BITS %d IN BYTES %d sizeof (mac_rlc_max_rx_header_size_t) %d\n", + printf("[RLC-LOOP] FOUND TB SIZE IN BITS %d IN BYTES %u sizeof (mac_rlc_max_rx_header_size_t) %d\n", ((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits, tb_size, sizeof (mac_rlc_max_rx_header_size_t)); *tx_packetsP = *tx_packetsP + 1; diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c index 1cc5ba776716aaa925bbeae984956d61d5c0682b..fda84879be06681705e62bbd15b1b7fe3f769284 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c @@ -148,7 +148,8 @@ void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, uns buffer_marker = 0; } - buffer_marker+=snprintf(&rlc_2_print_buffer[buffer_marker], RLC_2_PRINT_BUFFER_LEN - buffer_marker, " %04ld |", octet_index); + buffer_marker+=snprintf(&rlc_2_print_buffer[buffer_marker], RLC_2_PRINT_BUFFER_LEN - buffer_marker, + " %04lu |", octet_index); } /* @@ -382,7 +383,7 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma if (tb_src != NULL) { tb_size = ((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits >> 3; - printf("[RLC-LOOP] FOUND TB SIZE IN BITS %d IN BYTES %d sizeof (mac_rlc_max_rx_header_size_t) %d\n", + printf("[RLC-LOOP] FOUND TB SIZE IN BITS %d IN BYTES %u sizeof (mac_rlc_max_rx_header_size_t) %d\n", ((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits, tb_size, sizeof (mac_rlc_max_rx_header_size_t)); *tx_packetsP = *tx_packetsP + 1; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 792299f4ae47d7f5fdbb03bbf9f30bf889955672..ba5ece42c0b3d5a2ed10ec00dbae963d08a27549 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -1396,16 +1396,12 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( } } - SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[next_xid]; - DRB_configList2 = &ue_context_pP->ue_context.DRB_configList2[next_xid]; + SRB_configList2 = &(ue_context_pP->ue_context.SRB_configList2[next_xid]); + DRB_configList2 = &(ue_context_pP->ue_context.DRB_configList2[next_xid]); - if(SRB_configList2!=NULL) { - if (*SRB_configList2) { - free(*SRB_configList2); - LOG_D(RRC, "free(ue_context_pP->ue_context.SRB_configList2[%d])\n", next_xid); - } - } else { - LOG_E(RRC, "SRB_configList2 is null\n"); + if (*SRB_configList2) { + free(*SRB_configList2); + LOG_D(RRC, "free(ue_context_pP->ue_context.SRB_configList2[%d])\n", next_xid); } *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); @@ -1423,13 +1419,9 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( LOG_W(RRC,"SRB2 configuration does not exist in SRB configuration list\n"); } - if(DRB_configList2!=NULL) { - if (*DRB_configList2) { - free(*DRB_configList2); - LOG_D(RRC, "free(ue_context_pP->ue_context.DRB_configList2[%d])\n", next_xid); - } - } else { - LOG_E(RRC, "DRB_configList2 is null\n"); + if (*DRB_configList2) { + free(*DRB_configList2); + LOG_D(RRC, "free(ue_context_pP->ue_context.DRB_configList2[%d])\n", next_xid); } *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index ebacfc838119b779badc14625022513390247db5..71ae4c2e7ac0e4a114c3703927dd6ae43220e972 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -270,7 +270,7 @@ rrc_eNB_S1AP_get_ue_ids( } else { LOG_E(RRC, "[eNB %ld] Incoherence between RRC context and S1AP context (%d != %d) for UE RNTI %d or UE RRC context doesn't exist\n", rrc_instance_pP - RC.rrc[0], - ue_context_p->ue_context.eNB_ue_s1ap_id, + (ue_context_p==NULL)?99999:ue_context_p->ue_context.eNB_ue_s1ap_id, eNB_ue_s1ap_id, result->ue_rnti); } @@ -300,8 +300,7 @@ rrc_eNB_S1AP_remove_ue_ids( ) //------------------------------------------------------------------------------ { - const uint16_t ue_initial_id = ue_ids_pP->ue_initial_id; - const uint32_t eNB_ue_s1ap_id = ue_ids_pP->eNB_ue_s1ap_id; + hashtable_rc_t h_rc; if (rrc_instance_pP == NULL) { @@ -313,7 +312,8 @@ rrc_eNB_S1AP_remove_ue_ids( LOG_E(RRC, "Trying to free a NULL S1AP UE IDs\n"); return; } - + const uint16_t ue_initial_id = ue_ids_pP->ue_initial_id; + const uint32_t eNB_ue_s1ap_id = ue_ids_pP->eNB_ue_s1ap_id; if (eNB_ue_s1ap_id > 0) { h_rc = hashtable_remove(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id); diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.h b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.h index ffa9c0c85e7814932729a92baf2727472d804896..8f2908e52aa182f11d8067d4c005addf4f01f778 100644 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.h +++ b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.h @@ -32,7 +32,7 @@ extern uint32_t g_log_level; { \ char _logStr[1024]; \ snprintf(_logStr, 1024, __VA_ARGS__); \ - printf("NWGTPv2U-APP %s - %s <%s,%u>\n", gLogLevelStr[_logLevel], _logStr, basename(__FILE__), __LINE__);\ + printf("NWGTPv2U-APP %s - %s <%s,%d>\n", gLogLevelStr[_logLevel], _logStr, basename(__FILE__), __LINE__);\ } \ } while(0) diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.c b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.c index f6102d52508057c7e9f24de0c3bc63bb2beba1d8..63ad59b23f82b5cd731305a8c1258b48efe5cd37 100644 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.c +++ b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.c @@ -64,8 +64,8 @@ NwGtpv1uRcT nwTimerStart( NwGtpv1uTimerMgrHandleT tmrMgrHandle, struct timeval tv; NW_LOG(NW_LOG_LEVEL_INFO, - "Received start timer request from stack with timer type %u, arg %x, for %u sec and %u usec", - tmrType, timeoutArg, timeoutSec, timeoutUsec); + "Received start timer request from stack with timer type %d , arg %x, for %d sec and %d usec", + tmrType, (unsigned int)timeoutArg, timeoutSec, timeoutUsec); pTmr = (NwMiniTmrMgrEntityT *) malloc (sizeof(NwMiniTmrMgrEntityT)); @@ -90,7 +90,7 @@ NwGtpv1uRcT nwTimerStop( NwGtpv1uTimerMgrHandleT tmrMgrHandle, NwGtpv1uTimerHandleT hTmr) { NW_LOG(NW_LOG_LEVEL_INFO, - "Received stop timer request from stack for timer handle %u", hTmr); + "Received stop timer request from stack for timer handle %d", hTmr); evtimer_del(&(((NwMiniTmrMgrEntityT *)hTmr)->ev)); free((void *)hTmr); return NW_GTPV1U_OK; diff --git a/openair3/NAS/COMMON/UTIL/tst/timer.c b/openair3/NAS/COMMON/UTIL/tst/timer.c index 701c878f4de3f5cd728109d20c9d928de44e31c7..2215bcee2d1ff2241f50be34712072be4afecdee 100644 --- a/openair3/NAS/COMMON/UTIL/tst/timer.c +++ b/openair3/NAS/COMMON/UTIL/tst/timer.c @@ -96,7 +96,7 @@ int main (int argc, const char* argv[]) /* Start NB_TIMERS_MAX timers to expire at time interval of 1s */ for (int i=0; i < NB_TIMERS_MAX; i++) { if (_start(&timer[i], i) != RETURNok) { - printf("ERROR: timer_start(i=%u) failed\n", i); + printf("ERROR: timer_start(i=%d) failed\n", i); } } diff --git a/openair3/NAS/TEST/NETWORK/network_simulator.c b/openair3/NAS/TEST/NETWORK/network_simulator.c index 294241a3845fbf6d663daad85365a16d707d6c34..461f701f95181d08a1c8cd2cb4a6a6de7dc33f8e 100644 --- a/openair3/NAS/TEST/NETWORK/network_simulator.c +++ b/openair3/NAS/TEST/NETWORK/network_simulator.c @@ -319,7 +319,7 @@ int main (int argc, const char* argv[]) _network_simulator_msg_sent += 1; } - printf("\nINFO\t: %d messages received, %d messages sent\n", + printf("\nINFO\t: %u messages received, %u messages sent\n", _network_simulator_msg_recv, _network_simulator_msg_sent); } diff --git a/openair3/NAS/TEST/USER/user_simulator.c b/openair3/NAS/TEST/USER/user_simulator.c index fa015df30af33599815c5341059ba2a831716964..1c429c3b8508c1b766d0c27a0d1289d3d2edb8a7 100644 --- a/openair3/NAS/TEST/USER/user_simulator.c +++ b/openair3/NAS/TEST/USER/user_simulator.c @@ -143,7 +143,7 @@ int main (int argc, const char* argv[]) } printf("INFO\t: The User Simulator is now connected to %s (%d)\n", - devpath, USER_GETFD()); + devpath, (int)USER_GETFD()); } else { /* Initialize network socket handlers */ _user_simulator_id.open = socket_udp_open; @@ -163,7 +163,7 @@ int main (int argc, const char* argv[]) } printf("INFO\t: The User Simulator is now connected to %s/%s (%d)\n", - host, port, USER_GETFD()); + host, port, (int)USER_GETFD()); } @@ -231,7 +231,7 @@ int main (int argc, const char* argv[]) /* * Termination cleanup */ - printf("INFO\t: Closing user endpoint descriptor %d\n", USER_GETFD()); + printf("INFO\t: Closing user endpoint descriptor %d\n", (int)USER_GETFD()); USER_CLOSE(); printf("INFO\t: User simulator exited\n"); @@ -282,7 +282,7 @@ static int _set_signal_handler(int signal, void (handler)(int)) static void _signal_handler(int signal_number) { printf("\nWARNING\t: Signal %d received\n", signal_number); - printf("INFO\t: Closing user socket %d\n", USER_GETFD()); + printf("INFO\t: Closing user socket %d\n", (int)USER_GETFD()); USER_CLOSE(); printf("INFO\t: User simulator exited\n"); exit(EXIT_SUCCESS);