From bdaef7956d5b7f0b97dda2605c69438e73736680 Mon Sep 17 00:00:00 2001 From: gabrielC <couturier.gabriel@gmail.com> Date: Thu, 11 May 2017 11:48:30 +0200 Subject: [PATCH] bug fixes from Fujitsu (bugs 18, 19, 20) ---------------------------------------------------------- bug 18 Ttile: Probably he/she wants to copy the contents of arrays, but this coding doesn't copy anything, moreover index overflow occurs. Bug Location: u2e_t[UE_id][eNB_id]->tx_data[3]=tx[eNB_id][3]; u2e_t[UE_id][eNB_id]->rx_data[3]=rx[NB_eNB_INST+UE_id][3]; Note: Detected by CppCheck ---------------------------------------------------------- bug 19 Title: Probably he/she wants to copy the contents of arrays, but this coding doesn't copy anything, moreover index overflow occurs. Bug Location: e2u_t[eNB_id][UE_id]->tx_data[3]=tx[NB_eNB_INST+UE_id][3]; e2u_t[eNB_id][UE_id]->rx_data[3]=rx[eNB_id][3]; Note: Detected by CppCheck ---------------------------------------------------------- bug 20 Title: Probably he/she wants to copy the contents of arrays, but this coding doesn't copy anything, moreover index overflow occurs. Bug Location: tx_data[3]=cthread->tx_data[3]; rx_data[3]=cthread->rx_data[3]; Note: Detected by CppCheck ---------------------------------------------------------- --- targets/SIMU/PROC/Process.c | 15 +++++++++++---- targets/SIMU/PROC/channel_sim_proc.c | 9 +++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/targets/SIMU/PROC/Process.c b/targets/SIMU/PROC/Process.c index ee3d6d5c53c..9d80c74d99b 100644 --- a/targets/SIMU/PROC/Process.c +++ b/targets/SIMU/PROC/Process.c @@ -284,8 +284,12 @@ void Channel_Inst(int node_id,int port,double **s_re[MAX_eNB+MAX_UE],double **s_ u2e_t[UE_id][eNB_id]->next_slot=&next_slot; u2e_t[UE_id][eNB_id]->abstraction_flag=&abstraction_flag; u2e_t[UE_id][eNB_id]->frame_parms=frame_parms; - u2e_t[UE_id][eNB_id]->tx_data[3]=tx[eNB_id][3]; - u2e_t[UE_id][eNB_id]->rx_data[3]=rx[NB_eNB_INST+UE_id][3]; + + for (int i=0;i<3;i++) + { + u2e_t[UE_id][eNB_id]->tx_data[i]=tx[eNB_id][i]; + u2e_t[UE_id][eNB_id]->rx_data[i]=rx[NB_eNB_INST+UE_id][i]; + } if(pthread_cond_init (&downlink_cond[eNB_id][UE_id], NULL)) exit(1); @@ -316,8 +320,11 @@ void Channel_Inst(int node_id,int port,double **s_re[MAX_eNB+MAX_UE],double **s_ e2u_t[eNB_id][UE_id]->next_slot=&next_slot; e2u_t[eNB_id][UE_id]->abstraction_flag=&abstraction_flag; e2u_t[eNB_id][UE_id]->frame_parms=frame_parms; - e2u_t[eNB_id][UE_id]->tx_data[3]=tx[NB_eNB_INST+UE_id][3]; - e2u_t[eNB_id][UE_id]->rx_data[3]=rx[eNB_id][3]; + for (int i=0;i<3;i++) + { + e2u_t[eNB_id][UE_id]->tx_data[i]=tx[NB_eNB_INST+UE_id][i]; + e2u_t[eNB_id][UE_id]->rx_data[i]=rx[eNB_id][i]; + } if(pthread_cond_init (&uplink_cond[UE_id][eNB_id], NULL)) exit(1); diff --git a/targets/SIMU/PROC/channel_sim_proc.c b/targets/SIMU/PROC/channel_sim_proc.c index 0ffdd97ce09..b54fe36460c 100644 --- a/targets/SIMU/PROC/channel_sim_proc.c +++ b/targets/SIMU/PROC/channel_sim_proc.c @@ -183,8 +183,13 @@ void do_DL_sig_channel_T(void *param) next_slot=(cthread->next_slot); abstraction_flag=*(cthread->abstraction_flag); thread_id=(cthread->thread_id); - tx_data[3]=cthread->tx_data[3]; - rx_data[3]=cthread->rx_data[3]; + + for (int i=0;i<3;i++) + { + tx_data[i]=cthread->tx_data[i]; + rx_data[i]=cthread->rx_data[i]; + } + s32 att_eNB_id=-1; s32 **txdata,**rxdata; -- GitLab