Commit f0a8a0b3 authored by Lionel Gauthier's avatar Lionel Gauthier

patches13/0026-fix-sigsegv-suspicious-use-of-N_TA-offset.patch

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7072 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 1f92a249
...@@ -1518,9 +1518,9 @@ void fill_ue_band_info(void) { ...@@ -1518,9 +1518,9 @@ void fill_ue_band_info(void) {
int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs]) int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs])
{ {
#ifndef EXMIMO //#ifndef EXMIMO
uint16_t N_TA_offset = 0; // uint16_t N_TA_offset = 0;
#endif //#endif
int i, CC_id; int i, CC_id;
LTE_DL_FRAME_PARMS *frame_parms; LTE_DL_FRAME_PARMS *frame_parms;
...@@ -1534,16 +1534,16 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg, ...@@ -1534,16 +1534,16 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg,
} }
#ifndef EXMIMO //#ifndef EXMIMO
if (frame_parms->frame_type == TDD) { // if (frame_parms->frame_type == TDD) {
if (frame_parms->N_RB_DL == 100) // if (frame_parms->N_RB_DL == 100)
N_TA_offset = 624; // N_TA_offset = 624;
else if (frame_parms->N_RB_DL == 50) // else if (frame_parms->N_RB_DL == 50)
N_TA_offset = 624/2; // N_TA_offset = 624/2;
else if (frame_parms->N_RB_DL == 25) // else if (frame_parms->N_RB_DL == 25)
N_TA_offset = 624/4; // N_TA_offset = 624/4;
} // }
#endif //#endif
#ifdef EXMIMO #ifdef EXMIMO
openair0_cfg[CC_id].tx_num_channels = 0; openair0_cfg[CC_id].tx_num_channels = 0;
...@@ -1586,25 +1586,26 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg, ...@@ -1586,25 +1586,26 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg,
#else #else
// replace RX signal buffers with mmaped HW versions // replace RX signal buffers with mmaped HW versions
rxdata = (int32_t**)malloc16(frame_parms->nb_antennas_rx*sizeof(int32_t*)); rxdata = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
txdata = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*)); txdata = (int32_t**)malloc16( frame_parms->nb_antennas_tx*sizeof(int32_t*) );
for (i=0;i<frame_parms->nb_antennas_rx;i++) { for (i=0; i<frame_parms->nb_antennas_rx; i++) {
printf("Mapping UE CC_id %d, rx_ant %d, freq %u on card %d, chain %d\n",CC_id,i,downlink_frequency[CC_id][i],rf_map[CC_id].card,rf_map[CC_id].chain+i); printf( "Mapping UE CC_id %d, rx_ant %d, freq %u on card %d, chain %d\n", CC_id, i, downlink_frequency[CC_id][i], rf_map[CC_id].card, rf_map[CC_id].chain+i );
free(phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[i]); free( phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[i] );
rxdata[i] = (int32_t*)malloc16(samples_per_frame*sizeof(int32_t)); rxdata[i] = (int32_t*)malloc16_clear( samples_per_frame*sizeof(int32_t) );
phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[i] = rxdata[i]-N_TA_offset; // N_TA offset for TDD phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[i] = rxdata[i]; // what about the "-N_TA_offset" ? // N_TA offset for TDD
} }
for (i=0;i<frame_parms->nb_antennas_tx;i++) { for (i=0; i<frame_parms->nb_antennas_tx; i++) {
printf("Mapping UE CC_id %d, tx_ant %d, freq %u on card %d, chain %d\n",CC_id,i,downlink_frequency[CC_id][i],rf_map[CC_id].card,rf_map[CC_id].chain+i); printf( "Mapping UE CC_id %d, tx_ant %d, freq %u on card %d, chain %d\n", CC_id, i, downlink_frequency[CC_id][i], rf_map[CC_id].card, rf_map[CC_id].chain+i );
free(phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i]); free( phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i] );
txdata[i] = (int32_t*)malloc16(samples_per_frame*sizeof(int32_t)); txdata[i] = (int32_t*)malloc16_clear( samples_per_frame*sizeof(int32_t) );
phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i] = txdata[i]; phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[i] = txdata[i];
memset(txdata[i], 0, samples_per_frame*sizeof(int32_t));
} }
// rxdata[x] points now to the same memory region as phy_vars_ue[CC_id]->lte_ue_common_vars.rxdata[x]
// txdata[x] points now to the same memory region as phy_vars_ue[CC_id]->lte_ue_common_vars.txdata[x]
// be careful when releasing memory!
// because no "release_ue_buffers"-function is available, at least rxdata and txdata memory will leak (only some bytes)
#endif #endif
} }
return(0); return 0;
} }
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