Commit 277dc11e authored by yaojie's avatar yaojie

fix cppcheck warning

parent 72c11e64
...@@ -69,7 +69,7 @@ task_list_t tasks[TASK_MAX]; ...@@ -69,7 +69,7 @@ task_list_t tasks[TASK_MAX];
if (leP != NULL) { if (leP != NULL) {
free(leP); free(leP);
LOG_D(TMR, "intertask_interface free_mem_block is called, after free leP is %p\n", leP); LOG_D(TMR, "intertask_interface free_mem_block is called, after free leP is %p\n", leP);
leP = NULL; //prevent double free //leP = NULL; //prevent double free
} else { } else {
LOG_I(TMR, "intertask_interface free_mem_block is called, but before free leP is NULL\n"); LOG_I(TMR, "intertask_interface free_mem_block is called, but before free leP is NULL\n");
} }
......
...@@ -257,7 +257,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, ...@@ -257,7 +257,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
fp->N_RB_UL = cfg->carrier_config.ul_grid_size[cfg->ssb_config.scs_common.value].value; fp->N_RB_UL = cfg->carrier_config.ul_grid_size[cfg->ssb_config.scs_common.value].value;
int Ncp = NFAPI_CP_NORMAL; int Ncp = NFAPI_CP_NORMAL;
int mu = cfg!= NULL ? cfg->ssb_config.scs_common.value : 0; int mu = cfg->ssb_config.scs_common.value;
#if DISABLE_LOG_X #if DISABLE_LOG_X
printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, fp->N_RB_DL, Ncp); printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, fp->N_RB_DL, Ncp);
...@@ -305,7 +305,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, ...@@ -305,7 +305,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
} }
fp->N_ssb = 0; fp->N_ssb = 0;
int num_tx_ant = (cfg == NULL) ? fp->Lmax : cfg->carrier_config.num_tx_ant.value; int num_tx_ant = cfg->carrier_config.num_tx_ant.value;
for (int p=0; p<num_tx_ant; p++) for (int p=0; p<num_tx_ant; p++)
fp->N_ssb += ((fp->L_ssb >> p) & 0x01); fp->N_ssb += ((fp->L_ssb >> p) & 0x01);
......
...@@ -3721,8 +3721,8 @@ void *UE_thread_slot1_dl_processing(void *arg) { ...@@ -3721,8 +3721,8 @@ void *UE_thread_slot1_dl_processing(void *arg) {
CPU_SET(threads.slot1_proc_one, &cpuset); CPU_SET(threads.slot1_proc_one, &cpuset);
if ( (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.slot1_proc_two != -1 ) if ( (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.slot1_proc_two != -1 )
CPU_SET(threads.slot1_proc_two, &cpuset); CPU_SET(threads.slot1_proc_two, &cpuset);
if ( (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.slot1_proc_three != -1 ) //if ( (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.slot1_proc_three != -1 ) //(proc->sub_frame_start+1)%RX_NB_TH is always less than 2.
CPU_SET(threads.slot1_proc_three, &cpuset); //CPU_SET(threads.slot1_proc_three, &cpuset);
init_thread(900000,1000000 , FIFO_PRIORITY-1, &cpuset, init_thread(900000,1000000 , FIFO_PRIORITY-1, &cpuset,
threadname); threadname);
......
...@@ -3682,8 +3682,8 @@ void *UE_thread_slot1_dl_processing(void *arg) { ...@@ -3682,8 +3682,8 @@ void *UE_thread_slot1_dl_processing(void *arg) {
if ( (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.slot1_proc_two != -1 ) if ( (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.slot1_proc_two != -1 )
CPU_SET(threads.slot1_proc_two, &cpuset); CPU_SET(threads.slot1_proc_two, &cpuset);
if ( (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.slot1_proc_three != -1 ) //if ( (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.slot1_proc_three != -1 ) //(proc->sub_frame_start+1)%RX_NB_TH it is always less than 2.
CPU_SET(threads.slot1_proc_three, &cpuset); //CPU_SET(threads.slot1_proc_three, &cpuset);
init_thread(900000,1000000, FIFO_PRIORITY-1, &cpuset, init_thread(900000,1000000, FIFO_PRIORITY-1, &cpuset,
threadname); threadname);
......
...@@ -2241,7 +2241,7 @@ get_numnarrowbands(long dl_Bandwidth) ...@@ -2241,7 +2241,7 @@ get_numnarrowbands(long dl_Bandwidth)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
int nb_tab[6] = { 1, 2, 4, 8, 12, 16 }; int nb_tab[6] = { 1, 2, 4, 8, 12, 16 };
if (dl_Bandwidth >= 7 && dl_Bandwidth < 0) { if (dl_Bandwidth >= 7 || dl_Bandwidth < 0) {
LOG_E(MAC, "dl_Bandwidth not in [0..6]\n"); LOG_E(MAC, "dl_Bandwidth not in [0..6]\n");
return (-1); return (-1);
} }
...@@ -2254,7 +2254,7 @@ get_numnarrowbandbits(long dl_Bandwidth) ...@@ -2254,7 +2254,7 @@ get_numnarrowbandbits(long dl_Bandwidth)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
int nbbits_tab[6] = { 0, 1, 2, 3, 4, 4 }; int nbbits_tab[6] = { 0, 1, 2, 3, 4, 4 };
if (dl_Bandwidth >= 7 && dl_Bandwidth < 0) { if (dl_Bandwidth >= 7 || dl_Bandwidth < 0) {
LOG_E(MAC, "dl_Bandwidth not in [0..6]\n"); LOG_E(MAC, "dl_Bandwidth not in [0..6]\n");
return (-1); return (-1);
} }
......
...@@ -217,6 +217,8 @@ uint8_t do_MIB_FeMBMS(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_ ...@@ -217,6 +217,8 @@ uint8_t do_MIB_FeMBMS(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_
default: default:
LOG_E(RRC,"Unknown dl_Bandwidth %d\n",N_RB_DL); LOG_E(RRC,"Unknown dl_Bandwidth %d\n",N_RB_DL);
free(spare);
spare = NULL;
return(-1); return(-1);
} }
......
...@@ -1794,6 +1794,11 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, ...@@ -1794,6 +1794,11 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance,
X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest, X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest,
X2AP_ProtocolIE_ID_id_NRUESecurityCapabilities, true); X2AP_ProtocolIE_ID_id_NRUESecurityCapabilities, true);
if (ie == NULL ) {
X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
return -1;
}
X2AP_ENDC_SGNB_ADDITION_REQ(msg).security_capabilities.encryption_algorithms = X2AP_ENDC_SGNB_ADDITION_REQ(msg).security_capabilities.encryption_algorithms =
BIT_STRING_to_uint16(&ie->value.choice.NRUESecurityCapabilities.nRencryptionAlgorithms); BIT_STRING_to_uint16(&ie->value.choice.NRUESecurityCapabilities.nRencryptionAlgorithms);
...@@ -1804,6 +1809,10 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, ...@@ -1804,6 +1809,10 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance,
X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest, X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest,
X2AP_ProtocolIE_ID_id_SgNBSecurityKey, true); X2AP_ProtocolIE_ID_id_SgNBSecurityKey, true);
if (ie == NULL ) {
X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
return -1;
}
if ((ie->value.choice.SgNBSecurityKey.buf) && if ((ie->value.choice.SgNBSecurityKey.buf) &&
(ie->value.choice.SgNBSecurityKey.size == 32)) { (ie->value.choice.SgNBSecurityKey.size == 32)) {
memcpy(X2AP_ENDC_SGNB_ADDITION_REQ(msg).kgnb, ie->value.choice.SgNBSecurityKey.buf, 32); memcpy(X2AP_ENDC_SGNB_ADDITION_REQ(msg).kgnb, ie->value.choice.SgNBSecurityKey.buf, 32);
...@@ -1823,6 +1832,10 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, ...@@ -1823,6 +1832,10 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance,
X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest, X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest,
X2AP_ProtocolIE_ID_id_E_RABs_ToBeAdded_SgNBAddReqList, true); X2AP_ProtocolIE_ID_id_E_RABs_ToBeAdded_SgNBAddReqList, true);
if (ie == NULL ) {
X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
return -1;
}
if (ie->value.choice.E_RABs_ToBeAdded_SgNBAddReqList.list.count > 0) { if (ie->value.choice.E_RABs_ToBeAdded_SgNBAddReqList.list.count > 0) {
...@@ -1871,6 +1884,10 @@ LOG_I(RRC,"x2u tunnel: index %d target sgw ip %d.%d.%d.%d length %d gtp teid %u\ ...@@ -1871,6 +1884,10 @@ LOG_I(RRC,"x2u tunnel: index %d target sgw ip %d.%d.%d.%d length %d gtp teid %u\
X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest, X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest,
X2AP_ProtocolIE_ID_id_MeNBtoSgNBContainer, true); X2AP_ProtocolIE_ID_id_MeNBtoSgNBContainer, true);
if (ie == NULL ) {
X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
return -1;
}
if (ie->value.choice.MeNBtoSgNBContainer.size > 8192 ) if (ie->value.choice.MeNBtoSgNBContainer.size > 8192 )
{ printf("%s:%d: fatal: buffer too big\n", __FILE__, __LINE__); abort(); } { printf("%s:%d: fatal: buffer too big\n", __FILE__, __LINE__); abort(); }
......
...@@ -825,8 +825,8 @@ static void *UE_thread_rxn_txnp4(void *arg) ...@@ -825,8 +825,8 @@ static void *UE_thread_rxn_txnp4(void *arg)
if ( (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.two != -1 ) if ( (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.two != -1 )
CPU_SET(threads.two, &cpuset); CPU_SET(threads.two, &cpuset);
if ( (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.three != -1 ) //if ( (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.three != -1 )
CPU_SET(threads.three, &cpuset); // CPU_SET(threads.three, &cpuset);
//CPU_SET(threads.three, &cpuset); //CPU_SET(threads.three, &cpuset);
init_thread(900000,1000000, FIFO_PRIORITY-1, &cpuset, init_thread(900000,1000000, FIFO_PRIORITY-1, &cpuset,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment