From fc86788a8ecf7c8f1bc64364b9af99ecafe2f99d Mon Sep 17 00:00:00 2001 From: Francois TABURET Date: Fri, 24 May 2019 10:18:10 +0200 Subject: [PATCH 01/93] Update BUILD.md, fixing broken link, typo and clarifying some points --- doc/BUILD.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/BUILD.md b/doc/BUILD.md index 094900daac..bdac5ae962 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -36,11 +36,7 @@ The oai softmodem supports many use cases, and new ones are regularly added. Mos - all simulators, with exception of PHY simulators, which are distinct executables. -Calling the `build_oai` script with the -h option gives the list of all available options, but a process to simplify and check the requirements of all these options is on-going. Check the - -[table]: BUILD.md "`build_oai` options" - -At the end of this page to know the status of `buid_oai` options which are not described hereafter. +Calling the `build_oai` script with the -h option gives the list of all available options, but a process to simplify and check the requirements of all these options is on-going. Check the [table](BUILD.md "`build_oai` options") At the end of this page to know the status of `buid_oai` options which are not described hereafter. # Building PHY Simulators @@ -53,7 +49,7 @@ After downloading the source files, a single build command can be used to get th ``` cd /openairinterface5g/ source oaienv -cd ../cmake_targets/ +cd cmake_targets/ ./build_oai -I -w USRP --eNB --UE ``` @@ -78,10 +74,16 @@ or `./build_oai --build-lib telnetsrv` +You can get documentation about the telnet server [here](common/utils/telnetsrv/DOC/telnetsrv.doc) + ## USRP record player The USRP record player today needs a specific build. Work to make it available as a run time option is under consideration +## Other optional libraries + +Using the help option of the build script you can get the list of available optional libraries. Those which haven't been mentioned above are known to need more tests and documentation + # `build_oai` options | Option | Status | Description | @@ -89,7 +91,7 @@ The USRP record player today needs a specific build. Work to make it available a | -h | maintained | get help | | -c | maintained | erase all previously built files for this target before starting the new build. | | -C | maintained, needs improvement | erase all previously built files for any target before starting the new build. | -| --verbose-compile | maintained | | +| --verbose-compile | maintained | get compilation messages, as when running `make` or `gcc` directly. | | --cflags_processor | maintained | used to pass options to the compiler | | --clean-kernel | unknown | no code in the script corresponding to this option | | --install-system-files | maintained | install oai built binaries in linux system files repositories | From 3b9fabe1b35773d80cfbf51eb72794dba8109eb8 Mon Sep 17 00:00:00 2001 From: Francois TABURET Date: Fri, 24 May 2019 10:26:55 +0200 Subject: [PATCH 02/93] Update BUILD.md --- doc/BUILD.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/BUILD.md b/doc/BUILD.md index bdac5ae962..1c05cbfb13 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -36,7 +36,7 @@ The oai softmodem supports many use cases, and new ones are regularly added. Mos - all simulators, with exception of PHY simulators, which are distinct executables. -Calling the `build_oai` script with the -h option gives the list of all available options, but a process to simplify and check the requirements of all these options is on-going. Check the [table](BUILD.md "`build_oai` options") At the end of this page to know the status of `buid_oai` options which are not described hereafter. +Calling the `build_oai` script with the -h option gives the list of all available options, but a process to simplify and check the requirements of all these options is on-going. Check the [table](BUILD.md "build_oai options") At the end of this page to know the status of `buid_oai` options which are not described hereafter. # Building PHY Simulators @@ -74,7 +74,7 @@ or `./build_oai --build-lib telnetsrv` -You can get documentation about the telnet server [here](common/utils/telnetsrv/DOC/telnetsrv.doc) +You can get documentation about the telnet server [here](common/utils/telnetsrv/DOC/telnetsrv.md) ## USRP record player From 55700fc99e849e0bee40d51913b047a7bd0a0a0b Mon Sep 17 00:00:00 2001 From: Francois TABURET Date: Fri, 24 May 2019 10:31:42 +0200 Subject: [PATCH 03/93] Update BUILD.md --- doc/BUILD.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/BUILD.md b/doc/BUILD.md index 1c05cbfb13..a2d62c31a0 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -36,7 +36,7 @@ The oai softmodem supports many use cases, and new ones are regularly added. Mos - all simulators, with exception of PHY simulators, which are distinct executables. -Calling the `build_oai` script with the -h option gives the list of all available options, but a process to simplify and check the requirements of all these options is on-going. Check the [table](BUILD.md "build_oai options") At the end of this page to know the status of `buid_oai` options which are not described hereafter. +Calling the `build_oai` script with the -h option gives the list of all available options, but a process to simplify and check the requirements of all these options is on-going. Check the [table](BUILD.md "# `build_oai` options") At the end of this page to know the status of `buid_oai` options which are not described hereafter. # Building PHY Simulators From f4ab9af045fcd38a16f71de4bd7d7f832a4c6987 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 18:41:18 +0900 Subject: [PATCH 04/93] Fix Coverity Scan CID 339961 --- common/config/config_cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c index 0083c2e66b..c67328f5a1 100644 --- a/common/config/config_cmdline.c +++ b/common/config/config_cmdline.c @@ -41,7 +41,7 @@ int parse_stringlist(paramdef_t *cfgoptions, char *val) { char *atoken; - char *tokctx; + char *tokctx = NULL; char *tmpval=strdup(val); int numelt=0; cfgoptions->numelt=0; From a51fb55f8a8b8433fa60194f264c28a3001d40d2 Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:08:42 +0900 Subject: [PATCH 05/93] Fix Coverity Scan CID 339968 --- openair2/RRC/LTE/rrc_eNB_S1AP.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 6357bcfc64..ddcd6983c8 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -846,6 +846,7 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( uint8_t srb_id; struct rrc_eNB_ue_context_s *ue_context_p = NULL; protocol_ctxt_t ctxt; + memset(&ctxt, 0, sizeof(protocol_ctxt_t)); ue_initial_id = S1AP_DOWNLINK_NAS (msg_p).ue_initial_id; eNB_ue_s1ap_id = S1AP_DOWNLINK_NAS (msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id); From 95b5f2babae3a6a6edcb26ffd6de88397d123876 Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:16:50 +0900 Subject: [PATCH 06/93] Fix Coverity Scan CID 339973 --- openair3/GTPV1-U/gtpv1u_eNB.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair3/GTPV1-U/gtpv1u_eNB.c b/openair3/GTPV1-U/gtpv1u_eNB.c index d904e90f22..b04d0dbf28 100644 --- a/openair3/GTPV1-U/gtpv1u_eNB.c +++ b/openair3/GTPV1-U/gtpv1u_eNB.c @@ -986,7 +986,7 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) { if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: while getting ue rnti %x in hashtable ue_mapping\n", data_req_p->rnti); } else { - if ((data_req_p->rab_id >= GTPV1U_BEARER_OFFSET) && (data_req_p->rab_id <= max_val_LTE_DRB_Identity)) { + if ((data_req_p->rab_id >= GTPV1U_BEARER_OFFSET) && (data_req_p->rab_id < max_val_LTE_DRB_Identity)) { enb_s1u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_eNB; sgw_s1u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_sgw; stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU; From 95c86931818af1ecff10001ab92fbb340376806a Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:18:27 +0900 Subject: [PATCH 07/93] Fix Coverity Scan CID 340000 --- openair2/LAYER2/MAC/pre_processor.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index e70ed082f9..f68db9ffec 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -1399,7 +1399,6 @@ dlsch_scheduler_pre_processor_reset(module_id_t module_idP, // for (CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++) { - LOG_D(MAC, "Running preprocessor for UE %d (%x)\n", UE_id,(int)(UE_RNTI(module_idP, UE_id))); // initialize harq_pid and round cc = &RC.mac[module_idP]->common_channels[CC_id]; N_RBG[CC_id] = to_rbg(cc->mib->message.dl_Bandwidth); From 9b10599186957830980b7c68ed1660971019442a Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:20:52 +0900 Subject: [PATCH 08/93] Fix Coverity Scan CID 340192 --- openair2/F1AP/f1ap_cu_interface_management.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index b451a01457..06e7a10a50 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -327,6 +327,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, /* - nRCGI */ F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(f1ap_setup_resp->mcc[i], f1ap_setup_resp->mnc[i], f1ap_setup_resp->mnc_digit_length[i], &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(f1ap_setup_resp->nr_cellid[i], &nRCGI.nRCellIdentity); From 4939f38a57e0f45e92e8a76b7aea1ba3cda9e637 Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:22:24 +0900 Subject: [PATCH 09/93] Fix Coverity Scan CID 340196 --- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 17d386343b..73e9851911 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -499,7 +499,7 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP) (void)data_p; pdcp_t *pdcp_p = NULL; //TTN for D2D (PC5S) - int prose_addr_len; + int prose_addr_len = 0; char send_buf[BUFSIZE], receive_buf[BUFSIZE]; //int optval; int bytes_received; From 550ac9841f69626a8b0522de8d7142b57475d786 Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:23:01 +0900 Subject: [PATCH 10/93] Fix Coverity Scan CID 340203 --- openair2/F1AP/f1ap_du_interface_management.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index f076b28a44..bcb4ce720a 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -169,6 +169,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* - nRCGI */ F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); LOG_D(F1AP, "plmn: (%d,%d)\n",f1ap_du_data->mcc[i],f1ap_du_data->mnc[i]); //MCC_MNC_TO_PLMNID(208, 95, 2, &nRCGI.pLMN_Identity); From 304c4842aafce6a5d4a3f9fdc089076c755a9af3 Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:23:28 +0900 Subject: [PATCH 11/93] Fix Coverity Scan CID 340210 --- targets/RT/USER/lte-softmodem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index a117c6b9c1..0dfbcff954 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -618,6 +618,8 @@ int main( int argc, char **argv ) { ctxt.instance = 0; ctxt.rnti = 0; ctxt.enb_flag = 1; + ctxt.frame = 0; + ctxt.subframe = 0; pdcp_run(&ctxt); } From 880432cafd19a2002ac79cb8e1fb186c3e22060f Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:24:10 +0900 Subject: [PATCH 12/93] Fix Coverity Scan CID 340222 --- openair2/F1AP/f1ap_du_interface_management.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index bcb4ce720a..63ff43829c 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -779,6 +779,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* 3.1 oldNRCGI */ F1AP_NRCGI_t oldNRCGI; + memset(&oldNRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &oldNRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &oldNRCGI.nRCellIdentity); @@ -945,6 +946,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* 3.1 oldNRCGI */ F1AP_NRCGI_t oldNRCGI; + memset(&oldNRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &oldNRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &oldNRCGI.nRCellIdentity); From c28d157dc461fba155d49d445d1c3b3ead59d440 Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:24:44 +0900 Subject: [PATCH 13/93] Fix Coverity Scan CID 340226 --- openair2/F1AP/f1ap_du_ue_context_management.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 1a80132ea8..7847bc28a5 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -470,6 +470,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { /* sCell_ID */ F1AP_NRCGI_t nRCGI; // issue here + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[0], &nRCGI.nRCellIdentity); From 80c7f25efd07fb8462ed22d051618f8b8892c15e Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:25:16 +0900 Subject: [PATCH 14/93] Fix Coverity Scan CID 340227 --- openair2/F1AP/f1ap_cu_ue_context_management.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 6f6a84e404..3bb0517282 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -95,6 +95,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_NRCGI; /* - nRCGI */ F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(f1ap_ue_context_setup_req->mcc, f1ap_ue_context_setup_req->mnc, f1ap_ue_context_setup_req->mnc_digit_length, From e241a74ae6be94e31dd2cf93bca8ea5a58f0b57c Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:26:59 +0900 Subject: [PATCH 15/93] Fix Coverity Scan CID 340229 --- openair2/F1AP/f1ap_du_interface_management.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 63ff43829c..83f3da57b2 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -620,6 +620,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); /* - nRCGI */ F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &nRCGI.pLMN_Identity); LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", nRCGI.nRCellIdentity.buf[0], @@ -792,6 +793,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* - nRCGI */ F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); @@ -983,6 +985,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* 3.1 oldNRCGI */ F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); From 72a6bbe22fdece02e11197dfc8d789ba9ee02c59 Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:27:30 +0900 Subject: [PATCH 16/93] Fix Coverity Scan CID 340231 --- openair2/F1AP/f1ap_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index e9e69732be..ea8b2c6739 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -177,7 +177,7 @@ int f1ap_du_add_cu_ue_id(f1ap_cudu_inst_t *f1_inst, module_id_t du_ue_f1ap_id, module_id_t cu_ue_f1ap_id) { module_id_t f1ap_uid = f1ap_get_du_uid(f1_inst,du_ue_f1ap_id); - if (f1ap_uid < 0) return -1; + if (f1ap_uid < 0 || f1ap_uid >= MAX_MOBILES_PER_ENB) return -1; f1_inst->f1ap_ue[f1ap_uid].cu_ue_f1ap_id = cu_ue_f1ap_id; LOG_I(F1AP, "Adding cu_ue_f1ap_id %d for UE with RNTI %x\n", cu_ue_f1ap_id, f1_inst->f1ap_ue[f1ap_uid].rnti); return 0; From 78b5f9da53345913264194ef0206c397c73a97da Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:28:08 +0900 Subject: [PATCH 17/93] Fix Coverity Scan CID 340246 --- openair2/F1AP/f1ap_cu_ue_context_management.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 3bb0517282..edc5a2c0a9 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -1184,6 +1184,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { // /* - sCell_ID */ F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); @@ -1223,6 +1224,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { /* - sCell_ID */ F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); From 6fa16963cbf6694537ccbb8ff2e71a83a818354b Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:28:45 +0900 Subject: [PATCH 18/93] Fix Coverity Scan CID 340253 --- openair2/F1AP/f1ap_cu_interface_management.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 06e7a10a50..941dc41a4d 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -563,6 +563,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ /* - nRCGI */ F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); @@ -612,6 +613,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ /* - nRCGI */ F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); @@ -788,6 +790,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ /* - nRCGI */ F1AP_NRCGI_t nRCGI; + memset(&nRCGI,0,sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); From 228ad9c824232cc09a9ef774121479f800186886 Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:30:12 +0900 Subject: [PATCH 19/93] Fix Coverity Scan CID 340255 --- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index bb477f5696..6ece2d53a5 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -799,6 +799,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_NRCGI; F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[0], f1ap_du_data->mnc[0], f1ap_du_data->mnc_digit_length[0], &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[0], &nRCGI.nRCellIdentity); From 3a92f18ecabb6e4e8bb3f2c3e419aac29e7bba9b Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:30:36 +0900 Subject: [PATCH 20/93] Fix Coverity Scan CID 340266 --- openair2/F1AP/f1ap_du_ue_context_management.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 7847bc28a5..f6fd66d50a 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -1156,6 +1156,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { /* - sCell_ID */ F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); From 5fe7940ef44490e4321b2de7ced9355fcf885d53 Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:31:19 +0900 Subject: [PATCH 21/93] Fix Coverity Scan CID 340273 --- openair2/UTIL/ASYNC_IF/socket_link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index e40fba4a04..570b2f4a58 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -402,7 +402,7 @@ static int socket_udp_receive(int socket_fd, void *buf, int size) LOG_D(PROTO_AGENT,"UDP RECEIVE\n"); struct sockaddr_in client; - socklen_t slen; + socklen_t slen = 0; int l; l = recvfrom(socket_fd, buf, size, 0, (struct sockaddr *) &client, &slen); From 4085349be35c18358c16bc8d74ee0817fb2b0899 Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:31:53 +0900 Subject: [PATCH 22/93] Fix Coverity Scan CID 340276 --- openair2/F1AP/f1ap_handlers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index a5b6a09963..12aba18a9d 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -98,7 +98,7 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, } /* Checking procedure Code and direction of message */ - if (pdu.choice.initiatingMessage->procedureCode > sizeof(f1ap_messages_callback) / (3 * sizeof( + if (pdu.choice.initiatingMessage->procedureCode >= sizeof(f1ap_messages_callback) / (3 * sizeof( f1ap_message_decoded_callback)) || (pdu.present > F1AP_F1AP_PDU_PR_unsuccessfulOutcome)) { LOG_E(F1AP, "[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", From ef9c22774675188791f6fe8f86d589ecc21f936d Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:32:32 +0900 Subject: [PATCH 23/93] Fix Coverity Scan CID 340288 --- openair2/UTIL/ASYNC_IF/socket_link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 570b2f4a58..a1e6b717ed 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -228,7 +228,7 @@ socket_link_t *new_link_udp_client(const char *server, int port){ struct sockaddr_in si_other; int s; - socklen_t slen; + socklen_t slen = 0; if ( (s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1){ goto error; From 3cfe9636abb6bb238d25bf5c0dd7c0a464754c41 Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Tue, 28 May 2019 19:33:00 +0900 Subject: [PATCH 24/93] Fix Coverity Scan CID 340291 --- openair2/F1AP/f1ap_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index ea8b2c6739..267626dd5c 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -187,7 +187,7 @@ int f1ap_cu_add_du_ue_id(f1ap_cudu_inst_t *f1_inst, module_id_t cu_ue_f1ap_id, module_id_t du_ue_f1ap_id) { module_id_t f1ap_uid = f1ap_get_cu_uid(f1_inst,cu_ue_f1ap_id); - if (f1ap_uid < 0) return -1; + if (f1ap_uid < 0 || f1ap_uid >= MAX_MOBILES_PER_ENB) return -1; f1_inst->f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id; LOG_I(F1AP, "Adding du_ue_f1ap_id %d for UE with RNTI %x\n", du_ue_f1ap_id, f1_inst->f1ap_ue[f1ap_uid].rnti); return 0; From f19c72f785edfe04ab891d485a427cbe29a1aee9 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 19:38:22 +0900 Subject: [PATCH 25/93] Fix Coverity Scan CID 339951 --- openair2/ENB_APP/enb_config.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 3d9b88b667..7cda65e522 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2572,6 +2572,7 @@ int RCconfig_parallel(void) { set_worker_conf(worker_conf); } + free(worker_conf); return 0; } From 1e4ca861842fa86f17ba08265cd83232da34e27b Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 19:40:07 +0900 Subject: [PATCH 26/93] Fix Coverity Scan CID 339948 --- common/utils/T/local_tracer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/common/utils/T/local_tracer.c b/common/utils/T/local_tracer.c index 4be0b35d16..253a64ee1e 100644 --- a/common/utils/T/local_tracer.c +++ b/common/utils/T/local_tracer.c @@ -75,6 +75,7 @@ static int get_connection(char *addr, int port) { socklen_t alen; int s, t; printf("T tracer: waiting for connection on %s:%d\n", addr, port); + memset(&a,0,sizeof(struct sockaddr_in)); s = socket(AF_INET, SOCK_STREAM, 0); if (s == -1) { From 7dc6547479b702e6a371494ae2a6769e935f7af0 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 19:41:59 +0900 Subject: [PATCH 27/93] Fix Coverity Scan CID 339944 --- openair2/ENB_APP/enb_config.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 7cda65e522..87d50732c6 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2573,6 +2573,7 @@ int RCconfig_parallel(void) { } free(worker_conf); + free(parallel_conf); return 0; } From 5d1500cbdc149a75d7c32eb2f3d7c4a68ca3a574 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 19:42:34 +0900 Subject: [PATCH 28/93] Fix Coverity Scan CID 339937 --- openair2/X2AP/x2ap_eNB_handler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/X2AP/x2ap_eNB_handler.c b/openair2/X2AP/x2ap_eNB_handler.c index 96ffac162e..531acff990 100644 --- a/openair2/X2AP/x2ap_eNB_handler.c +++ b/openair2/X2AP/x2ap_eNB_handler.c @@ -192,7 +192,7 @@ int x2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stre case X2AP_X2AP_PDU_PR_initiatingMessage: /* Checking procedure Code and direction of message */ - if (pdu.choice.initiatingMessage.procedureCode > sizeof(x2ap_messages_callback) / (3 * sizeof( + if (pdu.choice.initiatingMessage.procedureCode >= sizeof(x2ap_messages_callback) / (3 * sizeof( x2ap_message_decoded_callback))) { //|| (pdu.present > X2AP_X2AP_PDU_PR_unsuccessfulOutcome)) { X2AP_ERROR("[SCTP %d] Either procedureCode %ld exceed expected\n", From c41af020a28a8104321b2dea904a3a63f76591f0 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 20:14:25 +0900 Subject: [PATCH 29/93] Fix Coverity Scan CID 339932 (Overrunning array messages_callback of 48 24-byte elements at element index 48 (byte offset 1152) using index pdu.choice.initiatingMessage.procedureCode (which evaluates to 48).) --- openair3/S1AP/s1ap_eNB_handlers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index 0c3b1ee25b..18c6d98601 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -220,7 +220,7 @@ int s1ap_eNB_handle_message(uint32_t assoc_id, int32_t stream, } /* Checking procedure Code and direction of message */ - if (pdu.choice.initiatingMessage.procedureCode > sizeof(messages_callback) / (3 * sizeof( + if (pdu.choice.initiatingMessage.procedureCode >= sizeof(messages_callback) / (3 * sizeof( s1ap_message_decoded_callback)) || (pdu.present > S1AP_S1AP_PDU_PR_unsuccessfulOutcome)) { S1AP_ERROR("[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", From 0b48bb46be9a843bbc2775a72cb4f826962fbf1b Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 20:29:38 +0900 Subject: [PATCH 30/93] Fix Coverity Scan CID 339921 (Using uninitialized value tokctx when calling __strtok_r_1c.) --- common/config/config_cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c index c67328f5a1..249765a46e 100644 --- a/common/config/config_cmdline.c +++ b/common/config/config_cmdline.c @@ -214,7 +214,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) /* first check help options, either --help, -h or --help_
*/ if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) { - char *tokctx; + char *tokctx = NULL; pp=strtok_r(oneargv, "_",&tokctx); config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED; From 8c0db8086d521322fbdcd83391fc7b2831cdc17b Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 20:31:03 +0900 Subject: [PATCH 31/93] Fix Coverity Scan CID 339892 (Overrunning array msg_p->ittiMsg.rrc_mac_ccch_data_ind.sdu of 512 bytes by passing it to a function which accesses it at byte offset 1022 using argument msg_p->ittiMsg.rrc_mac_ccch_data_ind.sdu_size (which evaluates to 1023).) --- openair2/RRC/LTE/rrc_eNB.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 4ee71c13be..b8d94bf3af 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -7736,9 +7736,9 @@ void *rrc_enb_process_itti_msg(void *notUsed) { &ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); - if (RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= RRC_BUFFER_SIZE_MAX) { + if (RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= CCCH_SDU_SIZE) { LOG_I(RRC, "CCCH message has size %d > %d\n", - RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX); + RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,CCCH_SDU_SIZE); break; } From ccdd9f0495521253aed3386e9db27be1a8afc7a0 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 20:32:21 +0900 Subject: [PATCH 32/93] Fix Coverity Scan CID 300508 (Variable ul_info going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 7110f681d7..c15b936870 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1017,6 +1017,9 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle for (i = 0; i < sf_trigger_msg->n_dl_info; i++) { free(sf_trigger_msg->dl_info[i]->harq_status); } + for (i = 0; i < sf_trigger_msg->n_ul_info; i++) { + free(sf_trigger_msg->ul_info[i]); + } free(sf_trigger_msg->dl_info); free(sf_trigger_msg->ul_info); free(sf_trigger_msg); From a4a51eb9c7e252b79983d54de649c4e4ca9fd4b0 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 20:59:50 +0900 Subject: [PATCH 33/93] Fix Coverity Scan CID 300507 (Variable lc_ue_config going out of scope leaks the storage it points to.) --- openair2/ENB_APP/flexran_agent_common.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 88db41bbe3..25fbcfc8e7 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -514,8 +514,13 @@ int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Fl // Fill the config for each UE for (int i = 0; i < lc_config_reply_msg->n_lc_ue_config; i++) { lc_ue_config[i] = malloc(sizeof(Protocol__FlexLcUeConfig)); - - if (!lc_ue_config[i]) goto error; + if (!lc_ue_config[i]){ + for (int j = 0; j < i; j++){ + free(lc_ue_config[j]); + } + free(lc_ue_config); + goto error; + } protocol__flex_lc_ue_config__init(lc_ue_config[i]); const int UE_id = flexran_get_mac_ue_id(mod_id, i); @@ -527,8 +532,13 @@ int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Fl *msg = malloc(sizeof(Protocol__FlexranMessage)); - if (*msg == NULL) + if (*msg == NULL){ + for (int k = 0; k < lc_config_reply_msg->n_lc_ue_config; k++){ + free(lc_ue_config[k]); + } + free(lc_ue_config); goto error; + } protocol__flexran_message__init(*msg); (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG; From ddb9b21878ec37d496e15f3859b7cbeb84732802 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:04:15 +0900 Subject: [PATCH 34/93] Fix Coverity Scan CID 300506 (Variable full_ul_report going out of scope leaks the storage it points to.) --- .../MAC/flexran_agent_mac_internal.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c index 6ce9038923..d866fe1c16 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c @@ -303,6 +303,20 @@ Protocol__FlexUlCqiReport * copy_ul_cqi_report(Protocol__FlexUlCqiReport * origi return full_ul_report; error: + if (full_ul_report){ + if (ul_report){ + for (i = 0; i < full_ul_report->n_cqi_meas; i++){ + if (ul_report[i]){ + if ( ul_report[i]->sinr ){ + free(ul_report[i]->sinr); + } + free(ul_report[i]); + } + } + free(ul_report); + } + free(full_ul_report); + } return NULL; } From 28ad28194412747086204742c6275a6f2f9a1bcb Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:05:31 +0900 Subject: [PATCH 35/93] Fix Coverity Scan CID 300504 (Using uninitialized value timer_msg when calling flexran_agent_stats_request.) --- openair2/ENB_APP/flexran_agent_handler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 9ffb1e6cec..2baad5afdc 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -293,7 +293,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr /* Check if request was periodical */ if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_PERIODICAL) { /* Create a one off flexran message as an argument for the periodical task */ - Protocol__FlexranMessage *timer_msg; + Protocol__FlexranMessage *timer_msg = NULL; stats_request_config_t request_config; request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS; request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE; From 5cb42d56f69386e5b3306b7ef77ad15f9a59d251 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:06:33 +0900 Subject: [PATCH 36/93] Fix Coverity Scan CID 300503 (Variable rlc_reports going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index c15b936870..b38304742b 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -122,8 +122,13 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, for (j = 0; j < ue_report[i]->n_rlc_report; j++) { rlc_reports[j] = malloc(sizeof(Protocol__FlexRlcBsr)); - if (rlc_reports[j] == NULL) + if (rlc_reports[j] == NULL){ + for (k = 0; k < j; k++){ + free(rlc_reports[k]); + } + free(rlc_reports); goto error; + } protocol__flex_rlc_bsr__init(rlc_reports[j]); rlc_reports[j]->lc_id = j+1; rlc_reports[j]->has_lc_id = 1; From e5a0b98ee45836111bb8f81eb22c2c419fb1798a Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:07:26 +0900 Subject: [PATCH 37/93] Fix Coverity Scan CID 300502 (Variable quantityConfig going out of scope leaks the storage it points to.) --- openair2/RRC/LTE/rrc_eNB.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index b8d94bf3af..551f116970 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -3915,6 +3915,18 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt size, buffer, PDCP_TRANSMISSION_MODE_CONTROL); + if (quantityConfig){ + if (quantityConfig->quantityConfigEUTRA){ + if (quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ){ + free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ); + } + if (quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP){ + free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP); + } + free(quantityConfig->quantityConfigEUTRA); + } + free(quantityConfig); + } } From f6b615636f2d65a846bec06a7cc1004c95ec265c Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:10:25 +0900 Subject: [PATCH 38/93] Fix Coverity Scan CID 300500 (Variable p_info going out of scope leaks the storage it points to.) --- .../CONTROL_MODULES/MAC/flexran_agent_mac_internal.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c index d866fe1c16..9359616d24 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c @@ -383,6 +383,18 @@ Protocol__FlexPagingBufferReport * copy_paging_buffer_report(Protocol__FlexPagin error: /*TODO: free memory properly*/ + if (copy){ + if (p_info){ + for (i = 0; i < copy->n_paging_info; i++){ + if (p_info[i]){ + free(p_info[i]); + } + } + free(p_info); + } + free(copy); + copy = NULL; + } return NULL; } From 736c3b988b0cc9814b696176a49086f40d844e1a Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:12:16 +0900 Subject: [PATCH 39/93] Fix Coverity Scan CID 300499 (Variable paging_report going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index b38304742b..a5742a5d43 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -407,14 +407,18 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, //Provide a report for each pending paging message Protocol__FlexPagingInfo **p_info; p_info = malloc(sizeof(Protocol__FlexPagingInfo *) * paging_report->n_paging_info); - if (p_info == NULL) + if (p_info == NULL){ + free(paging_report); goto error; + } for (j = 0; j < paging_report->n_paging_info; j++) { p_info[j] = malloc(sizeof(Protocol__FlexPagingInfo)); - if(p_info[j] == NULL) + if(p_info[j] == NULL){ + free(paging_report); goto error; + } protocol__flex_paging_info__init(p_info[j]); //TODO: Set paging index. This index is the same that will be used for the scheduling of the //paging message by the controller From f4def402b5d29bf28f59dde4103a4c4a08473e4c Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:13:11 +0900 Subject: [PATCH 40/93] Fix Coverity Scan CID 300497 (Using uninitialized element of array cpuset.__bits.) --- targets/RT/USER/lte-ru.c | 1 + 1 file changed, 1 insertion(+) diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 93a2440b94..1f8d6aac81 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -678,6 +678,7 @@ static void *emulatedRF_thread(void *param) { req.tv_sec = 0; req.tv_nsec = (numerology>0)? ((microsec * 1000L)/numerology):(microsec * 1000L)*2; cpu_set_t cpuset; + CPU_ZERO(&cpuset); CPU_SET(1,&cpuset); pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); int policy; From ba81c62eb7efd1ba9819ed3e07d5e5c86fd1d9c7 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:14:05 +0900 Subject: [PATCH 41/93] Fix Coverity Scan CID 300496 (Variable header going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index a5742a5d43..257cd444e2 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1075,6 +1075,7 @@ int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMess Protocol__FlexDlMacConfig *dl_mac_config_msg; dl_mac_config_msg = malloc(sizeof(Protocol__FlexDlMacConfig)); if (dl_mac_config_msg == NULL) { + free(header); goto error; } protocol__flex_dl_mac_config__init(dl_mac_config_msg); @@ -1084,8 +1085,10 @@ int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMess dl_mac_config_msg->sfn_sf = flexran_get_sfn_sf(mod_id); *msg = malloc(sizeof(Protocol__FlexranMessage)); - if(*msg == NULL) + if(*msg == NULL) { + free(header); goto error; + } protocol__flexran_message__init(*msg); (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG; (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; From 130c8d3da01c681222960662508cdefe7eae542d Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:15:24 +0900 Subject: [PATCH 42/93] Fix Coverity Scan CID 300490 (Variable copy going out of scope leaks the storage it points to.) --- .../CONTROL_MODULES/MAC/flexran_agent_mac_internal.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c index 9359616d24..c555130097 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c @@ -233,6 +233,12 @@ Protocol__FlexUeStatsReport * copy_ue_stats_report(Protocol__FlexUeStatsReport * return copy; error: + if (copy){ + if (copy->bsr){ + free(copy->bsr); + } + free(copy); + } return NULL; } From c3854df16ed03057549fb3437ca18811beed2508 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:16:57 +0900 Subject: [PATCH 43/93] Fix Coverity Scan CID 300478 (Variable dl_report going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 257cd444e2..d19399e256 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -185,8 +185,10 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, //Create the actual CSI reports. Protocol__FlexDlCsi **csi_reports; csi_reports = malloc(sizeof(Protocol__FlexDlCsi *)*dl_report->n_csi_report); - if (csi_reports == NULL) + if (csi_reports == NULL) { + free(dl_report); goto error; + } for (j = 0; j < dl_report->n_csi_report; j++) { csi_reports[j] = malloc(sizeof(Protocol__FlexDlCsi)); From 5e000215a377c9484cc495999fea6afcf08c3ff6 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:18:19 +0900 Subject: [PATCH 44/93] Fix Coverity Scan CID 300477 (Using uninitialized value err_code.) --- openair2/ENB_APP/flexran_agent_handler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 2baad5afdc..cdb508154f 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -420,7 +420,7 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg){ Protocol__FlexHeader *header = NULL; - err_code_t err_code; + err_code_t err_code = PROTOCOL__FLEXRAN_ERR__UNEXPECTED; int i; if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) From 9176f90a3d9c7a0e6e6dcea0b19b469e5d61b594 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:19:17 +0900 Subject: [PATCH 45/93] Fix Coverity Scan CID 300476 (Variable dl_mac_config_msg going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index d19399e256..1ae1127ec3 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1088,6 +1088,7 @@ int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMess *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) { + free(dl_mac_config_msg); free(header); goto error; } From c6a7f9d58f5889fbbc43eb6c4096f836564bca8f Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:21:59 +0900 Subject: [PATCH 46/93] Fix Coverity Scan CID 300474 (Using freed pointer timer_msg.) --- openair2/ENB_APP/flexran_agent_handler.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index cdb508154f..c8d7cf9e09 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -311,7 +311,10 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr report_config.ue_report_type[0].ue_report_flags = ue_flags; } request_config.config = &report_config; - flexran_agent_stats_request(enb_id, xid, &request_config, &timer_msg); + if (flexran_agent_stats_request(enb_id, xid, &request_config, &timer_msg) == -1) { + err_code = -100; + goto error; + } /* Create a timer */ long timer_id = 0; flexran_agent_timer_args_t *timer_args = malloc(sizeof(flexran_agent_timer_args_t)); From c91bfb228be262f3124942fbc40355baaf5377e0 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:25:02 +0900 Subject: [PATCH 47/93] Fix Coverity Scan CID 300472 (Variable header going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index a785c68163..b4a7db70e1 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -103,11 +103,15 @@ void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_ch } LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); + free(header); return; error: if (err_code != 0) LOG_E(FLEXRAN_AGENT, "Could not send UE state message becasue of %d for RNTI %x\n", err_code, rnti); + if (header){ + free(header); + } } From 64e0df286c6433d4509c49b23fb0e0f4709cd4de Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:25:59 +0900 Subject: [PATCH 48/93] Fix Coverity Scan CID 300465 (Variable header going out of scope leaks the storage it points to.) --- openair2/ENB_APP/flexran_agent_handler.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index c8d7cf9e09..5762eab426 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -521,6 +521,9 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re error : LOG_E(FLEXRAN_AGENT, "errno %d occured\n", err_code); + if (header){ + free(header); + } return err_code; } From 156726875a4f881f2c1501d7cc6a3cc0b2dd1edd Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:27:46 +0900 Subject: [PATCH 49/93] Fix Coverity Scan CID 300461 (Variable stats_reply_msg going out of scope leaks the storage it points to.) --- openair2/ENB_APP/flexran_agent_handler.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 5762eab426..54598bbe49 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -449,8 +449,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *) * report_config->nr_ue); - if (ue_report == NULL) + if (ue_report == NULL) { + free(stats_reply_msg); goto error; + } for (i = 0; i < report_config->nr_ue; i++) { @@ -468,14 +470,18 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *) * report_config->nr_cc); - if (cell_report == NULL) + if (cell_report == NULL) { + free(stats_reply_msg); goto error; + } for (i = 0; i < report_config->nr_cc; i++) { cell_report[i] = malloc(sizeof(Protocol__FlexCellStatsReport)); - if(cell_report[i] == NULL) + if(cell_report[i] == NULL) { + free(stats_reply_msg); goto error; + } protocol__flex_cell_stats_report__init(cell_report[i]); cell_report[i]->carrier_index = report_config->cc_report_type[i].cc_id; @@ -488,6 +494,7 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re if (flexran_agent_get_mac_xface(enb_id) && flexran_agent_mac_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; + free(stats_reply_msg); goto error; } @@ -495,6 +502,7 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re if (flexran_agent_get_rrc_xface(enb_id) && flexran_agent_rrc_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; + free(stats_reply_msg); goto error; } @@ -502,6 +510,7 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re if (flexran_agent_get_pdcp_xface(enb_id) && flexran_agent_pdcp_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; + free(stats_reply_msg); goto error; } @@ -510,8 +519,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re stats_reply_msg->ue_report = ue_report; *msg = malloc(sizeof(Protocol__FlexranMessage)); - if(*msg == NULL) + if(*msg == NULL) { + free(stats_reply_msg); goto error; + } protocol__flexran_message__init(*msg); (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG; (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; From 0398f964bb2dff90d1a14963eddd5871a9aea7b5 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:29:44 +0900 Subject: [PATCH 50/93] Fix Coverity Scan CID 300459 (Using uninitialized value addr. Field addr.sin_zero is uninitialized when calling bind.) --- openair2/UTIL/ASYNC_IF/socket_link.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index a1e6b717ed..633240026d 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -53,6 +53,7 @@ socket_link_t *new_link_server(int port) int no_delay; + memset(&addr,0,sizeof(struct sockaddr_in)); ret = calloc(1, sizeof(socket_link_t)); if (ret == NULL) { LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); From bf3db975bbeaa1b5fe9c527da98a463ecaf06b78 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:31:17 +0900 Subject: [PATCH 51/93] Fix Coverity Scan CID 300456 (Variable full_ul_report going out of scope leaks the storage it points to.) --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 1ae1127ec3..c853f81622 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -461,14 +461,18 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, full_ul_report->n_cqi_meas = 1; Protocol__FlexUlCqi **ul_report; ul_report = malloc(sizeof(Protocol__FlexUlCqi *) * full_ul_report->n_cqi_meas); - if(ul_report == NULL) + if(ul_report == NULL) { + free(full_ul_report); goto error; + } //Fill each UL report of the UE for each of the configured report types for(j = 0; j < full_ul_report->n_cqi_meas; j++) { ul_report[j] = malloc(sizeof(Protocol__FlexUlCqi)); - if(ul_report[j] == NULL) - goto error; + if(ul_report[j] == NULL) { + free(full_ul_report); + goto error; + } protocol__flex_ul_cqi__init(ul_report[j]); //TODO: Set the type of the UL report. As an example set it to SRS UL report // See enum flex_ul_cqi_type in FlexRAN specification for more details @@ -479,8 +483,10 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, ul_report[j]->n_sinr = 0; uint32_t *sinr_meas; sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[j]->n_sinr); - if (sinr_meas == NULL) + if (sinr_meas == NULL) { + free(full_ul_report); goto error; + } //TODO:Set the SINR measurements for the specified type for (k = 0; k < ul_report[j]->n_sinr; k++) { sinr_meas[k] = 10; From 91be65e8a8c5ab3cccc90f5e50d9f78f47c45eb6 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:32:28 +0900 Subject: [PATCH 52/93] Fix Coverity Scan CID 300455 (Using uninitialized value msg when calling flexran_agent_mac_sf_trigger.) --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index c853f81622..4d137759e4 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1346,7 +1346,7 @@ void flexran_agent_send_sr_info(mid_t mod_id) { void flexran_agent_send_sf_trigger(mid_t mod_id) { int size; - Protocol__FlexranMessage *msg; + Protocol__FlexranMessage *msg = NULL; void *data; int priority = 0; err_code_t err_code; From 8dc8a1627d97d70b5b7d8a77ae7d0103107f9662 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:33:22 +0900 Subject: [PATCH 53/93] Fix Coverity Scan CID 300452 (Using uninitialized value addr. Field addr.sin_zero is uninitialized when calling connect.) --- openair2/UTIL/ASYNC_IF/socket_link.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 633240026d..4778843e38 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -123,6 +123,7 @@ socket_link_t *new_link_client(const char *server, int port) struct sockaddr_in addr; int no_delay; + memset(&addr,0,sizeof(struct sockaddr_in)); ret = calloc(1, sizeof(socket_link_t)); if (ret == NULL) { LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); From 0b328f3315aafb563852feb239d0572b28fbe760 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:34:20 +0900 Subject: [PATCH 54/93] Fix Coverity Scan CID 300448 (Using uninitialized value sl_DiscConfig. Field sl_DiscConfig.ext1 is uninitialized.) --- openair2/RRC/LTE/rrc_eNB.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 551f116970..82bd72d2d7 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -8303,6 +8303,7 @@ LTE_SL_CommConfig_r12_t rrc_eNB_get_sidelink_commTXPool( const protocol_ctxt_t * LTE_SL_DiscConfig_r12_t rrc_eNB_get_sidelink_discTXPool( const protocol_ctxt_t *const ctxt_pP, rrc_eNB_ue_context_t *const ue_context_pP, int n_discoveryMessages ) { //TODO LTE_SL_DiscConfig_r12_t sl_DiscConfig; + memset(&sl_DiscConfig,0,sizeof(LTE_SL_DiscConfig_r12_t)); sl_DiscConfig.discTxResources_r12 = CALLOC(1,sizeof(*sl_DiscConfig.discTxResources_r12)); sl_DiscConfig.discTxResources_r12->present = LTE_SL_DiscConfig_r12__discTxResources_r12_PR_setup; sl_DiscConfig.discTxResources_r12->choice.setup.present = LTE_SL_DiscConfig_r12__discTxResources_r12__setup_PR_scheduled_r12; From af0e318a82537dd35ba785f7071a6aaa0a8151df Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:35:13 +0900 Subject: [PATCH 55/93] Fix Coverity Scan CID 300435 (Variable channel going out of scope leaks the storage it points to.) --- openair2/ENB_APP/flexran_agent_async.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openair2/ENB_APP/flexran_agent_async.c b/openair2/ENB_APP/flexran_agent_async.c index fa2e0c9ff5..26c0d93259 100644 --- a/openair2/ENB_APP/flexran_agent_async.c +++ b/openair2/ENB_APP/flexran_agent_async.c @@ -84,6 +84,9 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c error: LOG_I(FLEXRAN_AGENT, "%s(): there was an error\n", __func__); + if (channel){ + free(channel); + } return NULL; } From 29081f0a16fcf4c5b2216bdef6411b22dbf6d026 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:37:30 +0900 Subject: [PATCH 56/93] Fix Coverity Scan CID 300431 (Overrunning array pdu_info_pP->li_list of 128 2-byte elements at element index 128 (byte offset 256) using index pdu_info_pP->num_li (which evaluates to 128).) --- openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c index 18db23eb55..a0569b7f00 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c @@ -112,7 +112,7 @@ signed int rlc_um_get_pdu_infos( // PROTOCOL_RLC_UM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs ", // PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), // pdu_info_pP->sn); - if(pdu_info_pP->num_li > RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU) { + if(pdu_info_pP->num_li >= RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU) { LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs \n", PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), pdu_info_pP->sn); From f8a9d517af6833c20933de4080f94481df5c2db9 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:38:38 +0900 Subject: [PATCH 57/93] Fix Coverity Scan CID 300430 (Using uninitialized value msg when calling flexran_agent_mac_sr_info.) --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 4d137759e4..9bd5a42f37 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1316,7 +1316,7 @@ void flexran_agent_init_mac_agent(mid_t mod_id) { void flexran_agent_send_sr_info(mid_t mod_id) { int size; - Protocol__FlexranMessage *msg; + Protocol__FlexranMessage *msg = NULL; void *data; int priority = 0; err_code_t err_code; From 3cbb53e0693b450dcda7d5e5e82bde3d31ef4bba Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:40:35 +0900 Subject: [PATCH 58/93] Fix Coverity Scan CID 300429 (Overrunning array buffer of 255 bytes by passing it to a function which accesses it at byte offset 65534 using argument size (which evaluates to 65535).) --- openair2/RRC/LTE/rrc_eNB.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 82bd72d2d7..a6865bdedd 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -8166,7 +8166,7 @@ rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink( //----------------------------------------------------------------------------- { uint8_t buffer[RRC_BUF_SIZE]; - uint16_t size = -1; + uint16_t size = 0; memset(buffer, 0, RRC_BUF_SIZE); // allocate dedicated pools for UE -sl-CommConfig/sl-DiscConfig (sl-V2X-ConfigDedicated) From 4e1beaa6e4d2ce690f616d8372d6c08dc108ba38 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:41:45 +0900 Subject: [PATCH 59/93] Fix Coverity Scan CID 300428 (Variable dl_info going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 9bd5a42f37..0ad687c5ff 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1033,6 +1033,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle if (sf_trigger_msg != NULL) { for (i = 0; i < sf_trigger_msg->n_dl_info; i++) { free(sf_trigger_msg->dl_info[i]->harq_status); + free(sf_trigger_msg->dl_info[i]); } for (i = 0; i < sf_trigger_msg->n_ul_info; i++) { free(sf_trigger_msg->ul_info[i]); From a7585c3fd4e629a9eed14d9f867b177bf0eac247 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:43:05 +0900 Subject: [PATCH 60/93] Fix Coverity Scan CID 300427 (Variable ue_report going out of scope leaks the storage it points to.) --- openair2/ENB_APP/flexran_agent_handler.c | 28 ++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 54598bbe49..9c3f271682 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -424,7 +424,7 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re Protocol__FlexHeader *header = NULL; err_code_t err_code = PROTOCOL__FLEXRAN_ERR__UNEXPECTED; - int i; + int i,j; if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) goto error; @@ -445,7 +445,7 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re // UE report - Protocol__FlexUeStatsReport **ue_report; + Protocol__FlexUeStatsReport **ue_report = NULL; ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *) * report_config->nr_ue); @@ -471,6 +471,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *) * report_config->nr_cc); if (cell_report == NULL) { + for (j = 0; j < report_config->nr_ue; j++) { + free(ue_report[j]); + } + free(ue_report); free(stats_reply_msg); goto error; } @@ -479,6 +483,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re cell_report[i] = malloc(sizeof(Protocol__FlexCellStatsReport)); if(cell_report[i] == NULL) { + for (j = 0; j < report_config->nr_ue; j++) { + free(ue_report[j]); + } + free(ue_report); free(stats_reply_msg); goto error; } @@ -494,6 +502,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re if (flexran_agent_get_mac_xface(enb_id) && flexran_agent_mac_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; + for (j = 0; j < report_config->nr_ue; j++) { + free(ue_report[j]); + } + free(ue_report); free(stats_reply_msg); goto error; } @@ -502,6 +514,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re if (flexran_agent_get_rrc_xface(enb_id) && flexran_agent_rrc_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; + for (j = 0; j < report_config->nr_ue; j++) { + free(ue_report[j]); + } + free(ue_report); free(stats_reply_msg); goto error; } @@ -510,6 +526,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re if (flexran_agent_get_pdcp_xface(enb_id) && flexran_agent_pdcp_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; + for (j = 0; j < report_config->nr_ue; j++) { + free(ue_report[j]); + } + free(ue_report); free(stats_reply_msg); goto error; } @@ -520,6 +540,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) { + for (j = 0; j < report_config->nr_ue; j++) { + free(ue_report[j]); + } + free(ue_report); free(stats_reply_msg); goto error; } From 542bd49c9699cab16f91d2adf82a4b3ad4090234 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:43:58 +0900 Subject: [PATCH 61/93] Fix Coverity Scan CID 300425 (Using uninitialized value req_msg when calling flexran_agent_stats_request.) --- openair2/ENB_APP/flexran_agent_handler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 9c3f271682..2d6640b8e8 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -746,7 +746,7 @@ err_code_t flexran_agent_enable_cont_stats_update(mid_t mod_id, goto error; } - Protocol__FlexranMessage *req_msg; + Protocol__FlexranMessage *req_msg = NULL; flexran_agent_stats_request(mod_id, xid, stats_req, &req_msg); stats_context[mod_id].stats_req = req_msg; From 5877ee80c76377417b4ab3b196df789ac5cbda3a Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:46:15 +0900 Subject: [PATCH 62/93] Fix Coverity Scan CID 300421 (Variable eutra_meas going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index b4a7db70e1..05de1e3721 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -409,8 +409,13 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, for (int j = 0; j < neigh_meas->n_eutra_meas; j++ ){ eutra_meas[j] = malloc(sizeof(Protocol__FlexEutraMeasurements)); - if (eutra_meas[j] == NULL) + if (eutra_meas[j] == NULL) { + for (int k = 0 ; k < j ; k++) { + free(eutra_meas[k]); + } + free(eutra_meas); goto error; + } protocol__flex_eutra_measurements__init(eutra_meas[j]); From ddf6cfe002ddeeef435725768e23440a7ed980c3 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 21:47:40 +0900 Subject: [PATCH 63/93] Fix Coverity Scan CID 300420 (Variable ul_mac_config_msg going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 0ad687c5ff..23ec58cfab 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1192,8 +1192,10 @@ int flexran_agent_mac_create_empty_ul_config(mid_t mod_id, Protocol__FlexranMess ul_mac_config_msg->sfn_sf = flexran_get_sfn_sf(mod_id); *msg = malloc(sizeof(Protocol__FlexranMessage)); - if(*msg == NULL) + if(*msg == NULL) { + free(ul_mac_config_msg); goto error; + } protocol__flexran_message__init(*msg); (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_MAC_CONFIG_MSG; (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; From e04f4c15c0aa3bc34798f14b66ab5f675b0698ba Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 22:02:04 +0900 Subject: [PATCH 64/93] Fix Coverity Scan CID 300419 (Variable cell_conf going out of scope leaks the storage it points to.) --- openair2/ENB_APP/flexran_agent_common.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 25fbcfc8e7..6c64c3214f 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -746,7 +746,13 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F for(int i = 0; i < enb_config_reply_msg->n_cell_config; i++) { cell_conf[i] = malloc(sizeof(Protocol__FlexCellConfig)); - if (!cell_conf[i]) goto error; + if (!cell_conf[i]) { + for (int j = 0; j < i; j++) { + free(cell_conf[j]); + } + free(cell_conf); + goto error; + } protocol__flex_cell_config__init(cell_conf[i]); @@ -768,8 +774,13 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F *msg = malloc(sizeof(Protocol__FlexranMessage)); - if(*msg == NULL) + if(*msg == NULL) { + for (int k = 0; k < enb_config_reply_msg->n_cell_config; k++) { + free(cell_conf[k]); + } + free(cell_conf); goto error; + } protocol__flexran_message__init(*msg); (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG; From 71a7ba5738798815e74aedd2b26fa4daeb8409a1 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 22:03:19 +0900 Subject: [PATCH 65/93] Fix Coverity Scan CID 300415 (Variable ul_report going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 23ec58cfab..185427c3de 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -470,6 +470,10 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, ul_report[j] = malloc(sizeof(Protocol__FlexUlCqi)); if(ul_report[j] == NULL) { + for (k = 0; k < j; k++) { + free(ul_report[k]); + } + free(ul_report); free(full_ul_report); goto error; } @@ -484,6 +488,10 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, uint32_t *sinr_meas; sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[j]->n_sinr); if (sinr_meas == NULL) { + for (k = 0; k < j; k++) { + free(ul_report[k]); + } + free(ul_report); free(full_ul_report); goto error; } From 1f752815cfaca9cda80b64d875d0f9942f30538b Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 22:04:20 +0900 Subject: [PATCH 66/93] Fix Coverity Scan CID 300414 (Variable lib going out of scope leaks the storage it points to.) --- .../CONTROL_MODULES/MAC/flexran_agent_mac_internal.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c index c555130097..a22cc425f9 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c @@ -934,6 +934,13 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { LOG_I(FLEXRAN_AGENT, "Scheduler could not be loaded\n"); } + if (flexran_agent_get_mac_xface(mod_id)) { + if (flexran_agent_get_mac_xface(mod_id)->dl_scheduler_loaded_lib != lib) { + dlclose(lib); + } + } else { + dlclose(lib); + } return 0; error: From 4f55adf6e2a93df55f11fc15d6b59283bbf755d3 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 22:16:38 +0900 Subject: [PATCH 67/93] Fix Coverity Scan CID 300412 (Variable macstats going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 185427c3de..6fb46a9aa7 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -598,8 +598,10 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, Protocol__FlexMacSdusDl ** mac_sdus; mac_sdus = malloc(sizeof(Protocol__FlexMacSdusDl) * flexran_get_num_mac_sdu_tx(mod_id, UE_id, cc_id)); - if (mac_sdus == NULL) + if (mac_sdus == NULL) { + free(macstats); goto error; + } macstats->n_mac_sdus_dl = flexran_get_num_mac_sdu_tx(mod_id, UE_id, cc_id); From e65b7022878d59b092b297a8553284c0cabeb9e8 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 22:17:55 +0900 Subject: [PATCH 68/93] Fix Coverity Scan CID 300411 (Using uninitialized value reconf_param->report_amount when calling flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration.) --- openair2/ENB_APP/flexran_agent_common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 6c64c3214f..16f74ccd2f 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -810,6 +810,8 @@ int flexran_agent_rrc_measurement(mid_t mod_id, const void *params, Protocol__Fl Protocol__FlexRrcTriggering *triggering = input->rrc_triggering; agent_reconf_rrc *reconf_param = malloc(sizeof(agent_reconf_rrc)); reconf_param->trigger_policy = triggering->rrc_trigger; + reconf_param->report_interval = 0; + reconf_param->report_amount = 0; struct rrc_eNB_ue_context_s *ue_context_p = NULL; RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[mod_id]->rrc_ue_head)) { PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, mod_id, ENB_FLAG_YES, ue_context_p->ue_context.rnti, flexran_get_current_frame(mod_id), flexran_get_current_subframe (mod_id), mod_id); From 554058d4b0eda057bf751c5d74581578f18e0e17 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 22:18:45 +0900 Subject: [PATCH 69/93] Fix Coverity Scan CID 300407 (Variable stats_reply_msg going out of scope leaks the storage it points to.) --- .../CONTROL_MODULES/MAC/flexran_agent_mac_internal.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c index a22cc425f9..2a7d1fe186 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c @@ -151,6 +151,15 @@ Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol return msg; error: + if (stats_reply_msg) { + if (stats_reply_msg->ue_report) { + free(stats_reply_msg->ue_report); + } + if (stats_reply_msg->cell_report) { + free(stats_reply_msg->cell_report); + } + free(stats_reply_msg); + } return NULL; } From 3c1f80f47b1e17048f9a2454767dcadea83be093 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 22:19:33 +0900 Subject: [PATCH 70/93] Fix Coverity Scan CID 300405 (Variable ue_state_change_msg going out of scope leaks the storage it points to.) --- .../ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index 05de1e3721..dfc50683ff 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -44,6 +44,8 @@ void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_ch int size; Protocol__FlexranMessage *msg = NULL; Protocol__FlexHeader *header = NULL; + Protocol__FlexUeStateChange *ue_state_change_msg = NULL; + Protocol__FlexUeConfig *config = NULL; void *data; int priority = 0; err_code_t err_code=0; @@ -53,7 +55,6 @@ void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_ch if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UE_STATE_CHANGE, &header) != 0) goto error; - Protocol__FlexUeStateChange *ue_state_change_msg; ue_state_change_msg = malloc(sizeof(Protocol__FlexUeStateChange)); if(ue_state_change_msg == NULL) { goto error; @@ -62,7 +63,6 @@ void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_ch ue_state_change_msg->has_type = 1; ue_state_change_msg->type = state_change; - Protocol__FlexUeConfig *config; config = malloc(sizeof(Protocol__FlexUeConfig)); if (config == NULL) { goto error; @@ -112,6 +112,15 @@ void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_ch if (header){ free(header); } + if (ue_state_change_msg) { + free(ue_state_change_msg); + } + if (config) { + free(config); + } + if (msg) { + free(msg); + } } From 8fcce371d8c48b0331bd1436af81c49959aa63e2 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 22:20:15 +0900 Subject: [PATCH 71/93] Fix Coverity Scan CID 300402 (Variable header going out of scope leaks the storage it points to.) --- openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 6fb46a9aa7..badf182e5d 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1214,6 +1214,10 @@ int flexran_agent_mac_create_empty_ul_config(mid_t mod_id, Protocol__FlexranMess return 0; error: + if(header){ + free(header); + header = NULL; + } return -1; } From 2d3d0f7ae7029e6c99ff5e6df980f5c6f1674d34 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 28 May 2019 22:21:04 +0900 Subject: [PATCH 72/93] Fix Coverity Scan CID 300396 (Variable mac_MainConfig going out of scope leaks the storage it points to.) --- openair2/RRC/LTE/rrc_eNB.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index a6865bdedd..8092c3390c 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -3927,6 +3927,19 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt } free(quantityConfig); } + + if(mac_MainConfig){ + if(mac_MainConfig->ul_SCH_Config){ + free(mac_MainConfig->ul_SCH_Config); + mac_MainConfig->ul_SCH_Config = NULL; + } + if(mac_MainConfig->phr_Config){ + free(mac_MainConfig->phr_Config); + mac_MainConfig->phr_Config = NULL; + } + free(mac_MainConfig); + mac_MainConfig = NULL; + } } From 69f68d13f508fc4640f8e851a4dce29dddd4b206 Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Wed, 29 May 2019 14:51:47 +0900 Subject: [PATCH 73/93] ReFix Coverity Scan CID 340273 (Using uninitialized value slen when calling recvfrom.) --- openair2/UTIL/ASYNC_IF/socket_link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 4778843e38..85e0b3ef8e 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -404,7 +404,7 @@ static int socket_udp_receive(int socket_fd, void *buf, int size) LOG_D(PROTO_AGENT,"UDP RECEIVE\n"); struct sockaddr_in client; - socklen_t slen = 0; + socklen_t slen = sizeof(client); int l; l = recvfrom(socket_fd, buf, size, 0, (struct sockaddr *) &client, &slen); From a8bd28cc8a4e4bd9b95bd759e36faf322fd7e846 Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Wed, 29 May 2019 14:54:39 +0900 Subject: [PATCH 74/93] ReFix Coverity Scan CID 340288 (Using uninitialized value slen when calling getsockname.) --- openair2/UTIL/ASYNC_IF/socket_link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 85e0b3ef8e..ad016cf2cc 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -230,7 +230,7 @@ socket_link_t *new_link_udp_client(const char *server, int port){ struct sockaddr_in si_other; int s; - socklen_t slen = 0; + socklen_t slen = sizeof(si_other); if ( (s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1){ goto error; From 4acb50f99e655a2e08ad83c9b2ffd7f92eb979e2 Mon Sep 17 00:00:00 2001 From: SAWADA Kentaro Date: Wed, 29 May 2019 15:25:38 +0900 Subject: [PATCH 75/93] ReFix Coverity Scan CID 340196 (Using uninitialized value prose_addr_len when calling recvfrom.) --- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 73e9851911..b2a7e9ddfc 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -499,7 +499,7 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP) (void)data_p; pdcp_t *pdcp_p = NULL; //TTN for D2D (PC5S) - int prose_addr_len = 0; + int prose_addr_len = sizeof(prose_pdcp_addr); char send_buf[BUFSIZE], receive_buf[BUFSIZE]; //int optval; int bytes_received; From 616ab1871958c6b92024f53e922aea8783822ee7 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Wed, 29 May 2019 17:36:56 +0900 Subject: [PATCH 76/93] ReFix Coverity Scan CID 339948 (Using uninitialized value a. Field a.sin_zero is uninitialized when calling bind.) --- common/utils/T/local_tracer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/common/utils/T/local_tracer.c b/common/utils/T/local_tracer.c index 253a64ee1e..4be0b35d16 100644 --- a/common/utils/T/local_tracer.c +++ b/common/utils/T/local_tracer.c @@ -75,7 +75,6 @@ static int get_connection(char *addr, int port) { socklen_t alen; int s, t; printf("T tracer: waiting for connection on %s:%d\n", addr, port); - memset(&a,0,sizeof(struct sockaddr_in)); s = socket(AF_INET, SOCK_STREAM, 0); if (s == -1) { From 33eefa2e54f204b7551dc3951375cd49570f3cb9 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Wed, 29 May 2019 17:41:09 +0900 Subject: [PATCH 77/93] ReFix Coverity Scan CID 300452 (Using uninitialized value addr. Field addr.sin_zero is uninitialized when calling connect.) --- openair2/UTIL/ASYNC_IF/socket_link.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index ad016cf2cc..8779e49fe0 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -123,7 +123,6 @@ socket_link_t *new_link_client(const char *server, int port) struct sockaddr_in addr; int no_delay; - memset(&addr,0,sizeof(struct sockaddr_in)); ret = calloc(1, sizeof(socket_link_t)); if (ret == NULL) { LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); From ec2ac48d9013e1201f0d35e608e61ed84c4a7a2d Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Wed, 29 May 2019 17:45:02 +0900 Subject: [PATCH 78/93] ReFix Coverity Scan CID 300459 (Using uninitialized value addr. Field addr.sin_zero is uninitialized when calling bind.) --- openair2/UTIL/ASYNC_IF/socket_link.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 8779e49fe0..5717624930 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -53,7 +53,6 @@ socket_link_t *new_link_server(int port) int no_delay; - memset(&addr,0,sizeof(struct sockaddr_in)); ret = calloc(1, sizeof(socket_link_t)); if (ret == NULL) { LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); From 983d20854318dd43a14cdc2748e5742338397429 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Thu, 30 May 2019 18:40:27 +0900 Subject: [PATCH 79/93] ReFix Coverity Scan CID 339937 (Overrunning array x2ap_messages_callback of 27 24-byte elements at element index 27 (byte offset 648) using index pdu.choice.successfulOutcome.procedureCode (which evaluates to 27).) --- openair2/X2AP/x2ap_eNB_handler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/X2AP/x2ap_eNB_handler.c b/openair2/X2AP/x2ap_eNB_handler.c index 531acff990..dd59791ec9 100644 --- a/openair2/X2AP/x2ap_eNB_handler.c +++ b/openair2/X2AP/x2ap_eNB_handler.c @@ -218,7 +218,7 @@ int x2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stre case X2AP_X2AP_PDU_PR_successfulOutcome: /* Checking procedure Code and direction of message */ - if (pdu.choice.successfulOutcome.procedureCode > sizeof(x2ap_messages_callback) / (3 * sizeof( + if (pdu.choice.successfulOutcome.procedureCode >= sizeof(x2ap_messages_callback) / (3 * sizeof( x2ap_message_decoded_callback))) { //|| (pdu.present > X2AP_X2AP_PDU_PR_unsuccessfulOutcome)) { X2AP_ERROR("[SCTP %d] Either procedureCode %ld exceed expected\n", @@ -244,7 +244,7 @@ int x2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stre case X2AP_X2AP_PDU_PR_unsuccessfulOutcome: /* Checking procedure Code and direction of message */ - if (pdu.choice.unsuccessfulOutcome.procedureCode > sizeof(x2ap_messages_callback) / (3 * sizeof( + if (pdu.choice.unsuccessfulOutcome.procedureCode >= sizeof(x2ap_messages_callback) / (3 * sizeof( x2ap_message_decoded_callback))) { //|| (pdu.present > X2AP_X2AP_PDU_PR_unsuccessfulOutcome)) { X2AP_ERROR("[SCTP %d] Either procedureCode %ld exceed expected\n", From 540e409b2eccfd99645c72728bd9810fab72fc00 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Thu, 30 May 2019 19:01:02 +0900 Subject: [PATCH 80/93] ReFix Coverity Scan CID 300508 (Variable ul_info going out of scope leaks the storage it points to.) --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index badf182e5d..d3c9f8d300 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1045,11 +1045,18 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle free(sf_trigger_msg->dl_info[i]->harq_status); free(sf_trigger_msg->dl_info[i]); } - for (i = 0; i < sf_trigger_msg->n_ul_info; i++) { - free(sf_trigger_msg->ul_info[i]); - } free(sf_trigger_msg->dl_info); - free(sf_trigger_msg->ul_info); + if (sf_trigger_msg->ul_info != NULL) { + for (i = 0; i < sf_trigger_msg->n_ul_info; i++) { + if (sf_trigger_msg->ul_info[i] != NULL) { + if (sf_trigger_msg->ul_info[i]->ul_reception != NULL) { + free(sf_trigger_msg->ul_info[i]->ul_reception); + } + free(sf_trigger_msg->ul_info[i]); + } + } + free(sf_trigger_msg->ul_info); + } free(sf_trigger_msg); } if(*msg != NULL) From 32bb6c9ebf47f02958e1f22e1f5d89afab1329d9 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Thu, 30 May 2019 19:10:05 +0900 Subject: [PATCH 81/93] ReFix Coverity Scan CID 300428 (Variable dl_info going out of scope leaks the storage it points to.) --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index d3c9f8d300..97c3b0b3f0 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1041,11 +1041,17 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle if (header != NULL) free(header); if (sf_trigger_msg != NULL) { - for (i = 0; i < sf_trigger_msg->n_dl_info; i++) { - free(sf_trigger_msg->dl_info[i]->harq_status); - free(sf_trigger_msg->dl_info[i]); + if (sf_trigger_msg->dl_info != NULL) { + for (i = 0; i < sf_trigger_msg->n_dl_info; i++) { + if (sf_trigger_msg->dl_info[i] != NULL) { + if (sf_trigger_msg->dl_info[i]->harq_status != NULL) { + free(sf_trigger_msg->dl_info[i]->harq_status); + } + free(sf_trigger_msg->dl_info[i]); + } + } + free(sf_trigger_msg->dl_info); } - free(sf_trigger_msg->dl_info); if (sf_trigger_msg->ul_info != NULL) { for (i = 0; i < sf_trigger_msg->n_ul_info; i++) { if (sf_trigger_msg->ul_info[i] != NULL) { From 324da70ee1592cfdc909b1a9c3cb57eaa10738d2 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Thu, 30 May 2019 23:04:16 +0900 Subject: [PATCH 82/93] ReFix Coverity Scan CID 300503 (Variable rlc_reports going out of scope leaks the storage it points to.) --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 123 +++++++++++++++++- 1 file changed, 119 insertions(+), 4 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 97c3b0b3f0..656cedfe62 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -680,10 +680,125 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, error: - if (cell_report != NULL) - free(cell_report); - if (ue_report != NULL) - free(ue_report); + if (cell_report != NULL) { + if (report_config->nr_cc > 0) { + for (i = 0; i < report_config->nr_cc; i++) { + if (cell_report[i]->noise_inter_report != NULL) { + free(cell_report[i]->noise_inter_report); + cell_report[i]->noise_inter_report = NULL; + } + } + } + free(cell_report); + cell_report = NULL; + } + + if (ue_report != NULL) { + if (report_config->nr_ue > 0) { + for (i = 0; i < report_config->nr_ue; i++) { + if (ue_report[i]->bsr != NULL) { + free(ue_report[i]->bsr); + ue_report[i]->bsr = NULL; + } + if (ue_report[i]->rlc_report != NULL) { + for (j = 0; j < ue_report[i]->n_rlc_report; j++) { + if (ue_report[i]->rlc_report[j] != NULL) { + free(ue_report[i]->rlc_report[j]); + ue_report[i]->rlc_report[j] = NULL; + } + } + free(ue_report[i]->rlc_report); + ue_report[i]->rlc_report = NULL; + } + if (ue_report[i]->dl_cqi_report != NULL) { + if (ue_report[i]->dl_cqi_report->csi_report != NULL) { + for (j = 0; j < ue_report[i]->dl_cqi_report->n_csi_report; j++) { + if (ue_report[i]->dl_cqi_report->csi_report[j] != NULL) { + if (ue_report[i]->dl_cqi_report->csi_report[j]->p10csi != NULL) { + free(ue_report[i]->dl_cqi_report->csi_report[j]->p10csi); + ue_report[i]->dl_cqi_report->csi_report[j]->p10csi = NULL; + } + if (ue_report[i]->dl_cqi_report->csi_report[j]->p11csi != NULL) { + if (ue_report[i]->dl_cqi_report->csi_report[j]->p11csi->wb_cqi != NULL) { + free(ue_report[i]->dl_cqi_report->csi_report[j]->p11csi->wb_cqi); + ue_report[i]->dl_cqi_report->csi_report[j]->p11csi->wb_cqi = NULL; + } + free(ue_report[i]->dl_cqi_report->csi_report[j]->p11csi); + ue_report[i]->dl_cqi_report->csi_report[j]->p11csi = NULL; + } + if (ue_report[i]->dl_cqi_report->csi_report[j]->p20csi != NULL) { + free(ue_report[i]->dl_cqi_report->csi_report[j]->p20csi); + ue_report[i]->dl_cqi_report->csi_report[j]->p20csi = NULL; + } + free(ue_report[i]->dl_cqi_report->csi_report[j]); + ue_report[i]->dl_cqi_report->csi_report[j] = NULL; + } + } + free(ue_report[i]->dl_cqi_report->csi_report); + ue_report[i]->dl_cqi_report->csi_report = NULL; + } + free(ue_report[i]->dl_cqi_report); + ue_report[i]->dl_cqi_report = NULL; + } + if (ue_report[i]->pbr != NULL) { + if (ue_report[i]->pbr->paging_info != NULL) { + for (j = 0; j < ue_report[i]->pbr->n_paging_info; j++) { + free(ue_report[i]->pbr->paging_info[j]); + ue_report[i]->pbr->paging_info[j] = NULL; + } + free(ue_report[i]->pbr->paging_info); + ue_report[i]->pbr->paging_info = NULL; + } + free(ue_report[i]->pbr); + ue_report[i]->pbr = NULL; + } + if (ue_report[i]->ul_cqi_report != NULL) { + if (ue_report[i]->ul_cqi_report->cqi_meas != NULL) { + for (j = 0; j < ue_report[i]->ul_cqi_report->n_cqi_meas; j++) { + if (ue_report[i]->ul_cqi_report->cqi_meas[j] != NULL) { + if (ue_report[i]->ul_cqi_report->cqi_meas[j]->sinr != NULL) { + free(ue_report[i]->ul_cqi_report->cqi_meas[j]->sinr); + ue_report[i]->ul_cqi_report->cqi_meas[j]->sinr = NULL; + } + free(ue_report[i]->ul_cqi_report->cqi_meas[j]); + ue_report[i]->ul_cqi_report->cqi_meas[j] = NULL; + } + } + free(ue_report[i]->ul_cqi_report->cqi_meas); + ue_report[i]->ul_cqi_report->cqi_meas = NULL; + } + if (ue_report[i]->ul_cqi_report->pucch_dbm != NULL) { + for (j = 0; j < MAX_NUM_CCs; j++) { + if (ue_report[i]->ul_cqi_report->pucch_dbm[j] != NULL) { + free(ue_report[i]->ul_cqi_report->pucch_dbm[j]); + ue_report[i]->ul_cqi_report->pucch_dbm[j] = NULL; + } + } + free(ue_report[i]->ul_cqi_report->pucch_dbm); + ue_report[i]->ul_cqi_report->pucch_dbm = NULL; + } + free(ue_report[i]->ul_cqi_report); + ue_report[i]->ul_cqi_report = NULL; + } + if (ue_report[i]->mac_stats != NULL) { + if (ue_report[i]->mac_stats->mac_sdus_dl != NULL) { + for (j = 0; j < ue_report[i]->mac_stats->n_mac_sdus_dl; j++) { + if (ue_report[i]->mac_stats->mac_sdus_dl[j] != NULL) { + free(ue_report[i]->mac_stats->mac_sdus_dl[j]); + ue_report[i]->mac_stats->mac_sdus_dl[j] = NULL; + } + } + free(ue_report[i]->mac_stats->mac_sdus_dl); + ue_report[i]->mac_stats->mac_sdus_dl = NULL; + } + free(ue_report[i]->mac_stats); + ue_report[i]->mac_stats = NULL; + } + } + } + free(ue_report); + ue_report = NULL; + } return -1; } From b19f9d9c6e3c890ce4466c735a997c6420baa488 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Fri, 31 May 2019 10:04:11 +0900 Subject: [PATCH 83/93] Fix Coverity Scan CID 341065 (Null-checking quantityConfig suggests that it may be null, but it has already been dereferenced on all paths leading to the check.) --- openair2/RRC/LTE/rrc_eNB.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 8092c3390c..63daa318d5 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -3915,18 +3915,18 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt size, buffer, PDCP_TRANSMISSION_MODE_CONTROL); - if (quantityConfig){ - if (quantityConfig->quantityConfigEUTRA){ - if (quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ){ - free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ); - } - if (quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP){ - free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP); - } - free(quantityConfig->quantityConfigEUTRA); + + if (quantityConfig->quantityConfigEUTRA){ + if (quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ){ + free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ); } - free(quantityConfig); + if (quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP){ + free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP); + } + free(quantityConfig->quantityConfigEUTRA); } + free(quantityConfig); + quantityConfig = NULL; if(mac_MainConfig){ if(mac_MainConfig->ul_SCH_Config){ From 1de860bc89ee9b9b05512935cca5d4d9e70e0937 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Fri, 31 May 2019 10:13:11 +0900 Subject: [PATCH 84/93] Fix Coverity Scan CID 341070 (Null-checking quantityConfig->quantityConfigEUTRA suggests that it may be null, but it has already been dereferenced on all paths leading to the check.) --- openair2/RRC/LTE/rrc_eNB.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 63daa318d5..8fe104f84c 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -3916,15 +3916,15 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt buffer, PDCP_TRANSMISSION_MODE_CONTROL); - if (quantityConfig->quantityConfigEUTRA){ - if (quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ){ - free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ); - } - if (quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP){ - free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP); - } - free(quantityConfig->quantityConfigEUTRA); - } + free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ); + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = NULL; + + free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP); + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = NULL; + + free(quantityConfig->quantityConfigEUTRA); + quantityConfig->quantityConfigEUTRA = NULL; + free(quantityConfig); quantityConfig = NULL; From 3dae026c09ae30b5ec558a33cb1d216e3f26c9b5 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Fri, 31 May 2019 10:23:58 +0900 Subject: [PATCH 85/93] Fix Coverity Scan CID 341067 (Null-checking mac_MainConfig suggests that it may be null, but it has already been dereferenced on all paths leading to the check.) --- openair2/RRC/LTE/rrc_eNB.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 8fe104f84c..240a7f3012 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -3928,18 +3928,16 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt free(quantityConfig); quantityConfig = NULL; - if(mac_MainConfig){ - if(mac_MainConfig->ul_SCH_Config){ - free(mac_MainConfig->ul_SCH_Config); - mac_MainConfig->ul_SCH_Config = NULL; - } - if(mac_MainConfig->phr_Config){ - free(mac_MainConfig->phr_Config); - mac_MainConfig->phr_Config = NULL; - } - free(mac_MainConfig); - mac_MainConfig = NULL; + if(mac_MainConfig->ul_SCH_Config){ + free(mac_MainConfig->ul_SCH_Config); + mac_MainConfig->ul_SCH_Config = NULL; } + if(mac_MainConfig->phr_Config){ + free(mac_MainConfig->phr_Config); + mac_MainConfig->phr_Config = NULL; + } + free(mac_MainConfig); + mac_MainConfig = NULL; } From 507c9cd2a40a842f6294582b107df32266a1540e Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Fri, 31 May 2019 10:27:17 +0900 Subject: [PATCH 86/93] Fix Coverity Scan CID 341071 (Null-checking mac_MainConfig->ul_SCH_Config suggests that it may be null, but it has already been dereferenced on all paths leading to the check.) --- openair2/RRC/LTE/rrc_eNB.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 240a7f3012..a84efd334b 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -3928,10 +3928,9 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt free(quantityConfig); quantityConfig = NULL; - if(mac_MainConfig->ul_SCH_Config){ - free(mac_MainConfig->ul_SCH_Config); - mac_MainConfig->ul_SCH_Config = NULL; - } + free(mac_MainConfig->ul_SCH_Config); + mac_MainConfig->ul_SCH_Config = NULL; + if(mac_MainConfig->phr_Config){ free(mac_MainConfig->phr_Config); mac_MainConfig->phr_Config = NULL; From 04732d3a8b0e3b4565e8a2ae8e5f6b9e95f076fb Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Fri, 31 May 2019 10:29:42 +0900 Subject: [PATCH 87/93] Fix Coverity Scan CID 341064 (Null-checking mac_MainConfig->phr_Config suggests that it may be null, but it has already been dereferenced on all paths leading to the check.) --- openair2/RRC/LTE/rrc_eNB.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index a84efd334b..1dd3a26053 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -3931,10 +3931,9 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt free(mac_MainConfig->ul_SCH_Config); mac_MainConfig->ul_SCH_Config = NULL; - if(mac_MainConfig->phr_Config){ - free(mac_MainConfig->phr_Config); - mac_MainConfig->phr_Config = NULL; - } + free(mac_MainConfig->phr_Config); + mac_MainConfig->phr_Config = NULL; + free(mac_MainConfig); mac_MainConfig = NULL; } From b75500ac79a1792d54268e8752df63b7ddbaffbe Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Fri, 31 May 2019 12:10:12 +0900 Subject: [PATCH 88/93] Fix Coverity Scan CID 341066 (Using freed pointer ue_report.) --- openair2/ENB_APP/flexran_agent_handler.c | 96 ++++++++++++------------ 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 2d6640b8e8..bef82d04cc 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -423,19 +423,21 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg){ Protocol__FlexHeader *header = NULL; + Protocol__FlexUeStatsReport **ue_report = NULL; + Protocol__FlexCellStatsReport **cell_report = NULL; + Protocol__FlexStatsReply *stats_reply_msg = NULL; err_code_t err_code = PROTOCOL__FLEXRAN_ERR__UNEXPECTED; int i,j; - if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) { goto error; - - - Protocol__FlexStatsReply *stats_reply_msg; + } stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply)); - if (stats_reply_msg == NULL) + if (stats_reply_msg == NULL) { goto error; + } protocol__flex_stats_reply__init(stats_reply_msg); stats_reply_msg->header = header; @@ -445,18 +447,18 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re // UE report - Protocol__FlexUeStatsReport **ue_report = NULL; - - ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *) * report_config->nr_ue); - if (ue_report == NULL) { - free(stats_reply_msg); - goto error; - } + + if (ue_report == NULL) { + goto error; + } for (i = 0; i < report_config->nr_ue; i++) { ue_report[i] = malloc(sizeof(Protocol__FlexUeStatsReport)); + if (ue_report[i] == NULL) { + goto error; + } protocol__flex_ue_stats_report__init(ue_report[i]); ue_report[i]->rnti = report_config->ue_report_type[i].ue_rnti; ue_report[i]->has_rnti = 1; @@ -465,17 +467,9 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re } // cell rpoert - - Protocol__FlexCellStatsReport **cell_report; - cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *) * report_config->nr_cc); if (cell_report == NULL) { - for (j = 0; j < report_config->nr_ue; j++) { - free(ue_report[j]); - } - free(ue_report); - free(stats_reply_msg); goto error; } @@ -483,11 +477,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re cell_report[i] = malloc(sizeof(Protocol__FlexCellStatsReport)); if(cell_report[i] == NULL) { - for (j = 0; j < report_config->nr_ue; j++) { - free(ue_report[j]); - } - free(ue_report); - free(stats_reply_msg); goto error; } @@ -502,11 +491,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re if (flexran_agent_get_mac_xface(enb_id) && flexran_agent_mac_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; - for (j = 0; j < report_config->nr_ue; j++) { - free(ue_report[j]); - } - free(ue_report); - free(stats_reply_msg); goto error; } @@ -514,11 +498,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re if (flexran_agent_get_rrc_xface(enb_id) && flexran_agent_rrc_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; - for (j = 0; j < report_config->nr_ue; j++) { - free(ue_report[j]); - } - free(ue_report); - free(stats_reply_msg); goto error; } @@ -526,11 +505,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re if (flexran_agent_get_pdcp_xface(enb_id) && flexran_agent_pdcp_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; - for (j = 0; j < report_config->nr_ue; j++) { - free(ue_report[j]); - } - free(ue_report); - free(stats_reply_msg); goto error; } @@ -540,11 +514,6 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) { - for (j = 0; j < report_config->nr_ue; j++) { - free(ue_report[j]); - } - free(ue_report); - free(stats_reply_msg); goto error; } protocol__flexran_message__init(*msg); @@ -556,11 +525,40 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re error : LOG_E(FLEXRAN_AGENT, "errno %d occured\n", err_code); - if (header){ - free(header); - } - return err_code; + if (header != NULL) { + free(header); + header = NULL; + } + + if (stats_reply_msg != NULL) { + free(stats_reply_msg); + stats_reply_msg = NULL; + } + + if (ue_report != NULL) { + for (j = 0; j < report_config->nr_ue; j++) { + if (ue_report[j] != NULL) { + free(ue_report[j]); + ue_report[j] = NULL; + } + } + free(ue_report); + ue_report = NULL; + } + + if (cell_report != NULL) { + for (j = 0; j < report_config->nr_cc; j++) { + if (cell_report[j] != NULL) { + free(cell_report[j]); + cell_report[j] = NULL; + } + } + free(cell_report); + cell_report = NULL; + } + + return err_code; } /* From 86d7a5cd6964f681d738eca617e1a70e0ea42595 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 4 Jun 2019 10:19:35 +0900 Subject: [PATCH 89/93] ReFix Coverity Scan CID 341066 (Using freed pointer ue_report.) --- openair2/ENB_APP/flexran_agent_handler.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index bef82d04cc..2ea6f75808 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -540,7 +540,6 @@ error : for (j = 0; j < report_config->nr_ue; j++) { if (ue_report[j] != NULL) { free(ue_report[j]); - ue_report[j] = NULL; } } free(ue_report); From e62bc308b8573f40920eda94a787530306737955 Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Tue, 4 Jun 2019 10:21:52 +0900 Subject: [PATCH 90/93] Fix Coverity Scan CID 341132 (Using freed pointer cell_report.) --- openair2/ENB_APP/flexran_agent_handler.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 2ea6f75808..0c2c32e4d6 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -550,7 +550,6 @@ error : for (j = 0; j < report_config->nr_cc; j++) { if (cell_report[j] != NULL) { free(cell_report[j]); - cell_report[j] = NULL; } } free(cell_report); From ee944efd04bf75df64c95642116fade08af55c75 Mon Sep 17 00:00:00 2001 From: jordan moore Date: Fri, 7 Jun 2019 05:35:58 +0200 Subject: [PATCH 91/93] Update lms_lib.cpp --- targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp b/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp index 1f0d78aba5..a57ebf8b6d 100644 --- a/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp +++ b/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp @@ -193,7 +193,7 @@ int trx_lms_start(openair0_device *device){ LMS_EnableChannel(lms_device,LMS_CH_RX,1,true); LMS_EnableChannel(lms_device,LMS_CH_TX,1,true); } */ - LMS_VCTCXOWrite(lms_device,129, true); + LMS_VCTCXOWrite(lms_device, 129); if (LMS_SetSampleRate(lms_device,device->openair0_cfg->sample_rate,2)!=0) { From 3c62968e94da94c69158f75c42cdaa2144211a81 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 7 Jun 2019 10:08:19 +0200 Subject: [PATCH 92/93] Updating the release notes Signed-off-by: Raphael Defosseux --- README.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/README.txt b/README.txt index 37f6a86571..8204bb0cb5 100644 --- a/README.txt +++ b/README.txt @@ -63,3 +63,4 @@ v1.0.0 -> January 2019. This version first implements the architectural split de A lot of bugfixes and a proper automated Continuous Integration process validates contributions. v1.0.1 -> February 2019: Bug fix for the UE L1 simulator. v1.0.2 -> February 2019: Full OAI support for 3.13.1 UHD +v1.0.3 -> June 2019: Bug fix for LimeSuite v19.04.0 API From b5aac45a8f4478d1e5a4d3ce3390e07a1456c5ee Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 7 Jun 2019 13:51:35 +0200 Subject: [PATCH 93/93] CI: testing all sim configurations (in basic/l2-nfapi simulators) even if no sync Signed-off-by: Raphael Defosseux --- ci-scripts/runTestOnVM.sh | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index 8dbbc9a544..fde8f745d0 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -1277,8 +1277,7 @@ function run_test_on_vm { do for BW in ${BW_CASES[@]} do - # Not Running in TDD-10MHz and TDD-20MHz : too unstable - #if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*10.* ]]; then continue; fi + # Not Running in TDD-20MHz : too unstable if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*20.* ]]; then continue; fi if [[ $BW =~ .*05.* ]]; then PRB=25; fi @@ -1300,15 +1299,9 @@ function run_test_on_vm { if [ $UE_SYNC -eq 0 ] then echo "Problem w/ eNB and UE not syncing" - terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR 0 - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC - recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR - full_basic_sim_destroy - echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + full_terminate STATUS=-1 - return + continue fi get_ue_ip_addr $VM_CMDS $VM_IP_ADDR 1 @@ -1739,14 +1732,8 @@ function run_test_on_vm { terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2 scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC - if [ $S1_NOS1_CFG -eq 1 ] - then - terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR - fi - full_l2_sim_destroy - echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log STATUS=-1 - return + continue fi if [ $S1_NOS1_CFG -eq 1 ]