fix several not tested malloc or calloc return value
This commit is contained in:
committed by
Robert Schmidt
parent
d372aa1b50
commit
278d2cbca1
@@ -300,12 +300,16 @@ configmodule_interface_t *load_configmodule(int argc,
|
|||||||
cfgmode = strdup(CONFIG_LIBCONFIGFILE);
|
cfgmode = strdup(CONFIG_LIBCONFIGFILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static configmodule_interface_t *cfgptr;
|
static configmodule_interface_t *cfgptr = NULL;
|
||||||
if (cfgptr)
|
if (cfgptr)
|
||||||
fprintf(stderr, "ERROR: Call load_configmodule more than one time\n");
|
fprintf(stderr, "ERROR: Call load_configmodule more than one time\n");
|
||||||
|
|
||||||
// The macros are not thread safe print_params and similar
|
// The macros are not thread safe print_params and similar
|
||||||
cfgptr = calloc(sizeof(configmodule_interface_t), 1);
|
cfgptr = calloc(sizeof(configmodule_interface_t), 1);
|
||||||
|
if (!cfgptr) {
|
||||||
|
fprintf(stderr, "ERROR: cannot allocate a memory for configuration\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
/* argv_info is used to memorize command line options which have been recognized */
|
/* argv_info is used to memorize command line options which have been recognized */
|
||||||
/* and to detect unrecognized command line options which might have been specified */
|
/* and to detect unrecognized command line options which might have been specified */
|
||||||
cfgptr->argv_info = calloc(sizeof(int32_t), argc+10);
|
cfgptr->argv_info = calloc(sizeof(int32_t), argc+10);
|
||||||
|
|||||||
@@ -375,32 +375,32 @@ char *telnet_getvarvalue(telnetshell_vardef_t *var, int varindex)
|
|||||||
char *val;
|
char *val;
|
||||||
switch (var[varindex].vartype) {
|
switch (var[varindex].vartype) {
|
||||||
case TELNET_VARTYPE_INT32:
|
case TELNET_VARTYPE_INT32:
|
||||||
val = malloc(64);
|
val = calloc_or_fail(1, 64);
|
||||||
snprintf(val, 64, "%i", *(int32_t *)(var[varindex].varvalptr));
|
snprintf(val, 64, "%i", *(int32_t *)(var[varindex].varvalptr));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TELNET_VARTYPE_INT64:
|
case TELNET_VARTYPE_INT64:
|
||||||
val = malloc(128);
|
val = calloc_or_fail(1, 128);
|
||||||
snprintf(val, 128, "%lli", (long long)*(int64_t *)(var[varindex].varvalptr));
|
snprintf(val, 128, "%lli", (long long)*(int64_t *)(var[varindex].varvalptr));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TELNET_VARTYPE_INT16:
|
case TELNET_VARTYPE_INT16:
|
||||||
val = malloc(16);
|
val = calloc_or_fail(1, 16);
|
||||||
snprintf(val, 16, "%hi", *(short *)(var[varindex].varvalptr));
|
snprintf(val, 16, "%hi", *(short *)(var[varindex].varvalptr));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TELNET_VARTYPE_INT8:
|
case TELNET_VARTYPE_INT8:
|
||||||
val = malloc(16);
|
val = calloc_or_fail(1, 16);
|
||||||
snprintf(val, 16, "%i", (int)(*(int8_t *)(var[varindex].varvalptr)));
|
snprintf(val, 16, "%i", (int)(*(int8_t *)(var[varindex].varvalptr)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TELNET_VARTYPE_UINT:
|
case TELNET_VARTYPE_UINT:
|
||||||
val = malloc(64);
|
val = calloc_or_fail(1, 64);
|
||||||
snprintf(val, 64, "%u", *(unsigned int *)(var[varindex].varvalptr));
|
snprintf(val, 64, "%u", *(unsigned int *)(var[varindex].varvalptr));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TELNET_VARTYPE_DOUBLE:
|
case TELNET_VARTYPE_DOUBLE:
|
||||||
val = malloc(32);
|
val = calloc_or_fail(1, 32);
|
||||||
snprintf(val, 32, "%g\n", *(double *)(var[varindex].varvalptr));
|
snprintf(val, 32, "%g\n", *(double *)(var[varindex].varvalptr));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -409,7 +409,7 @@ char *telnet_getvarvalue(telnetshell_vardef_t *var, int varindex)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
val = malloc(64);
|
val = calloc_or_fail(1, 64);
|
||||||
snprintf(val, 64, "ERR:var %i unknown type", varindex);
|
snprintf(val, 64, "ERR:var %i unknown type", varindex);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -927,7 +927,7 @@ int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmdde
|
|||||||
for (int j = 0; cmd[j].cmdfunc != NULL; j++) {
|
for (int j = 0; cmd[j].cmdfunc != NULL; j++) {
|
||||||
if (cmd[j].cmdflags & TELNETSRV_CMDFLAG_PUSHINTPOOLQ) {
|
if (cmd[j].cmdflags & TELNETSRV_CMDFLAG_PUSHINTPOOLQ) {
|
||||||
if (afifo == NULL) {
|
if (afifo == NULL) {
|
||||||
afifo = malloc(sizeof(notifiedFIFO_t));
|
afifo = calloc_or_fail(1, sizeof(notifiedFIFO_t));
|
||||||
initNotifiedFIFO(afifo);
|
initNotifiedFIFO(afifo);
|
||||||
}
|
}
|
||||||
cmd[j].qptr = afifo;
|
cmd[j].qptr = afifo;
|
||||||
@@ -957,7 +957,7 @@ int telnetsrv_checkbuildver(char *mainexec_buildversion, char **shlib_buildvers
|
|||||||
|
|
||||||
int telnetsrv_getfarray(loader_shlibfunc_t **farray) {
|
int telnetsrv_getfarray(loader_shlibfunc_t **farray) {
|
||||||
int const num_func_tln_srv = 3;
|
int const num_func_tln_srv = 3;
|
||||||
*farray = malloc(sizeof(loader_shlibfunc_t) * num_func_tln_srv);
|
*farray = calloc_or_fail(num_func_tln_srv, sizeof(loader_shlibfunc_t));
|
||||||
(*farray)[0].fname=TELNET_ADDCMD_FNAME;
|
(*farray)[0].fname=TELNET_ADDCMD_FNAME;
|
||||||
(*farray)[0].fptr=(int (*)(void) )add_telnetcmd;
|
(*farray)[0].fptr=(int (*)(void) )add_telnetcmd;
|
||||||
(*farray)[1].fname=TELNET_POLLCMDQ_FNAME;
|
(*farray)[1].fname=TELNET_POLLCMDQ_FNAME;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ int get_measurgroups(telnet_measurgroupdef_t **measurgroups) {
|
|||||||
|
|
||||||
void measurcmd_display_phycpu(telnet_printfunc_t prnt) {
|
void measurcmd_display_phycpu(telnet_printfunc_t prnt) {
|
||||||
PHY_VARS_NR_UE *UE = PHY_vars_UE_g[0][0];
|
PHY_VARS_NR_UE *UE = PHY_vars_UE_g[0][0];
|
||||||
telnet_cpumeasurdef_t cpumeasur[MAX_CPU_STAT_TYPE];
|
telnet_cpumeasurdef_t cpumeasur[MAX_CPU_STAT_TYPE] = {};
|
||||||
for (int i = 0; i < MAX_CPU_STAT_TYPE; i++) {
|
for (int i = 0; i < MAX_CPU_STAT_TYPE; i++) {
|
||||||
sprintf(cpumeasur[i].statname, "%s", UE->phy_cpu_stats.cpu_time_stats[i].meas_name);
|
sprintf(cpumeasur[i].statname, "%s", UE->phy_cpu_stats.cpu_time_stats[i].meas_name);
|
||||||
cpumeasur[i].astatptr = &UE->phy_cpu_stats.cpu_time_stats[i];
|
cpumeasur[i].astatptr = &UE->phy_cpu_stats.cpu_time_stats[i];
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ void measurcmd_display_rlcstats(telnet_printfunc_t prnt) {
|
|||||||
UE_info_t *UE_info = &(RC.mac[eNB_id]->UE_info);
|
UE_info_t *UE_info = &(RC.mac[eNB_id]->UE_info);
|
||||||
telnet_ltemeasurdef_t statsptr[]=LTE_RLCMEASURE;
|
telnet_ltemeasurdef_t statsptr[]=LTE_RLCMEASURE;
|
||||||
int num_rlcmeasure = sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t );
|
int num_rlcmeasure = sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t );
|
||||||
unsigned int *rlcstats = malloc(num_rlcmeasure*sizeof(unsigned int));
|
unsigned int *rlcstats = calloc_or_fail(num_rlcmeasure,sizeof(unsigned int));
|
||||||
eNB_MAC_INST *eNB = RC.mac[eNB_id];
|
eNB_MAC_INST *eNB = RC.mac[eNB_id];
|
||||||
|
|
||||||
for(int i=0; i <num_rlcmeasure ; i++) {
|
for(int i=0; i <num_rlcmeasure ; i++) {
|
||||||
|
|||||||
@@ -2786,11 +2786,10 @@ RU_t **RCconfig_RU(int nb_RU,int nb_L1_inst,PHY_VARS_eNB ***eNB,uint64_t *ru_mas
|
|||||||
config_getlist(config_get_if(), &RUParamList, RUParams, sizeofArray(RUParams), NULL);
|
config_getlist(config_get_if(), &RUParamList, RUParams, sizeofArray(RUParams), NULL);
|
||||||
RU_t **ru=NULL;
|
RU_t **ru=NULL;
|
||||||
if ( RUParamList.numelt > 0) {
|
if ( RUParamList.numelt > 0) {
|
||||||
ru = (RU_t **)malloc(nb_RU*sizeof(RU_t *));
|
ru = malloc_or_fail(nb_RU * sizeof(RU_t *));
|
||||||
|
|
||||||
for (int j = 0; j < nb_RU; j++) {
|
for (int j = 0; j < nb_RU; j++) {
|
||||||
ru[j] = (RU_t *)malloc(sizeof(RU_t));
|
ru[j] = calloc_or_fail(1,sizeof(RU_t));
|
||||||
memset((void *)ru[j],0,sizeof(RU_t));
|
|
||||||
ru[j]->idx = j;
|
ru[j]->idx = j;
|
||||||
LOG_I(PHY,"Creating ru[%d]:%p\n", j, ru[j]);
|
LOG_I(PHY,"Creating ru[%d]:%p\n", j, ru[j]);
|
||||||
ru[j]->if_timing = synch_to_ext_device;
|
ru[j]->if_timing = synch_to_ext_device;
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ int wls_fapi_nr_pnf_start()
|
|||||||
_this = (pnf_t *)(cfg);
|
_this = (pnf_t *)(cfg);
|
||||||
_this->terminate = 0;
|
_this->terminate = 0;
|
||||||
// Init PNF config
|
// Init PNF config
|
||||||
nfapi_pnf_phy_config_t *phy = (nfapi_pnf_phy_config_t *)malloc(sizeof(nfapi_pnf_phy_config_t));
|
nfapi_pnf_phy_config_t *phy = malloc_or_fail(sizeof(nfapi_pnf_phy_config_t));
|
||||||
memset(phy, 0, sizeof(nfapi_pnf_phy_config_t));
|
memset(phy, 0, sizeof(nfapi_pnf_phy_config_t));
|
||||||
|
|
||||||
phy->state = NFAPI_PNF_PHY_IDLE;
|
phy->state = NFAPI_PNF_PHY_IDLE;
|
||||||
|
|||||||
@@ -202,20 +202,16 @@ void pnf_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
|||||||
nfapi_pnf_phy_config_delete_all(&pnf->_public);
|
nfapi_pnf_phy_config_delete_all(&pnf->_public);
|
||||||
|
|
||||||
// create the phy records
|
// create the phy records
|
||||||
if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG)
|
if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG) {
|
||||||
{
|
for(int i = 0; i < req.pnf_phy_rf_config.number_phy_rf_config_info; ++i) {
|
||||||
int i = 0;
|
nfapi_pnf_phy_config_t* phy = calloc_or_fail(1,sizeof(nfapi_pnf_phy_config_t));
|
||||||
for(i = 0; i < req.pnf_phy_rf_config.number_phy_rf_config_info; ++i)
|
|
||||||
{
|
|
||||||
nfapi_pnf_phy_config_t* phy = (nfapi_pnf_phy_config_t*)malloc(sizeof(nfapi_pnf_phy_config_t));
|
|
||||||
memset(phy, 0, sizeof(nfapi_pnf_phy_config_t));
|
|
||||||
|
|
||||||
phy->state = NFAPI_PNF_PHY_IDLE;
|
phy->state = NFAPI_PNF_PHY_IDLE;
|
||||||
phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id;
|
phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id;
|
||||||
|
|
||||||
nfapi_pnf_phy_config_add(&(pnf->_public), phy);
|
nfapi_pnf_phy_config_add(&(pnf->_public), phy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pnf->_public.pnf_config_req)
|
if(pnf->_public.pnf_config_req)
|
||||||
{
|
{
|
||||||
@@ -269,19 +265,13 @@ void pnf_nr_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen
|
|||||||
nfapi_pnf_phy_config_delete_all(&pnf->_public);
|
nfapi_pnf_phy_config_delete_all(&pnf->_public);
|
||||||
|
|
||||||
// create the phy records
|
// create the phy records
|
||||||
if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG)
|
if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG) {
|
||||||
{
|
for(int i = 0; i < req.pnf_phy_rf_config.number_phy_rf_config_info; ++i) {
|
||||||
int i = 0;
|
nfapi_pnf_phy_config_t* phy = calloc_or_fail(1,sizeof(nfapi_pnf_phy_config_t));
|
||||||
for(i = 0; i < req.pnf_phy_rf_config.number_phy_rf_config_info; ++i)
|
phy->state = NFAPI_PNF_PHY_IDLE;
|
||||||
{
|
phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id;
|
||||||
nfapi_pnf_phy_config_t* phy = (nfapi_pnf_phy_config_t*)malloc(sizeof(nfapi_pnf_phy_config_t));
|
nfapi_pnf_phy_config_add(&(pnf->_public), phy);
|
||||||
memset(phy, 0, sizeof(nfapi_pnf_phy_config_t));
|
}
|
||||||
|
|
||||||
phy->state = NFAPI_PNF_PHY_IDLE;
|
|
||||||
phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id;
|
|
||||||
|
|
||||||
nfapi_pnf_phy_config_add(&(pnf->_public), phy);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pnf->_public.pnf_nr_config_req)
|
if(pnf->_public.pnf_nr_config_req)
|
||||||
@@ -2024,21 +2014,19 @@ int pnf_read_dispatch_message(pnf_t* pnf)
|
|||||||
// now have the size of the mesage
|
// now have the size of the mesage
|
||||||
}
|
}
|
||||||
|
|
||||||
if(message_size > stack_buffer_size)
|
if(message_size > stack_buffer_size) {
|
||||||
{
|
dynamic_buffer = malloc_or_fail(message_size);
|
||||||
dynamic_buffer = (uint8_t*)malloc(message_size);
|
|
||||||
|
|
||||||
if(dynamic_buffer == NULL)
|
if (dynamic_buffer == NULL) {
|
||||||
{
|
// todo : add error mesage
|
||||||
// todo : add error mesage
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size);
|
||||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size);
|
return -1;
|
||||||
return -1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
read_buffer = dynamic_buffer;
|
read_buffer = dynamic_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
|
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
|
||||||
|
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ t_interleaver_codebook *f1f2mat;
|
|||||||
short *il_tb;
|
short *il_tb;
|
||||||
__attribute__((constructor)) static void init_interleaver(void) {
|
__attribute__((constructor)) static void init_interleaver(void) {
|
||||||
int totSize=0;
|
int totSize=0;
|
||||||
f1f2mat=(t_interleaver_codebook*) malloc(sizeof(*f1f2mat) * sizeof(f1f2) / sizeof(*f1f2));
|
f1f2mat = malloc_or_fail(sizeof(*f1f2mat) * sizeof(f1f2) / sizeof(*f1f2));
|
||||||
for (int i=0; i < sizeof(f1f2)/sizeof(*f1f2) ; i++) {
|
for (int i=0; i < sizeof(f1f2)/sizeof(*f1f2) ; i++) {
|
||||||
f1f2mat[i].nb_bits=f1f2[i].nb_bits;
|
f1f2mat[i].nb_bits=f1f2[i].nb_bits;
|
||||||
f1f2mat[i].f1=f1f2[i].f1;
|
f1f2mat[i].f1=f1f2[i].f1;
|
||||||
@@ -458,7 +458,7 @@ __attribute__((constructor)) static void init_interleaver(void) {
|
|||||||
f1f2mat[i].beg_index=totSize;
|
f1f2mat[i].beg_index=totSize;
|
||||||
totSize+=f1f2mat[i].nb_bits;
|
totSize+=f1f2mat[i].nb_bits;
|
||||||
}
|
}
|
||||||
il_tb=(short*)malloc(sizeof(*il_tb)*totSize);
|
il_tb = malloc_or_fail(sizeof(*il_tb) * totSize);
|
||||||
int idx=0;
|
int idx=0;
|
||||||
for (int i=0; i < sizeof(f1f2)/sizeof(*f1f2) ; i++)
|
for (int i=0; i < sizeof(f1f2)/sizeof(*f1f2) ; i++)
|
||||||
for (uint64_t j=0; j<f1f2[i].nb_bits; j++)
|
for (uint64_t j=0; j<f1f2[i].nb_bits; j++)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits)
|
|||||||
uint8_t temp1[crcPolynomialSize], temp2[crcPolynomialSize];
|
uint8_t temp1[crcPolynomialSize], temp2[crcPolynomialSize];
|
||||||
|
|
||||||
uint8_t **crc_generator_matrix =
|
uint8_t **crc_generator_matrix =
|
||||||
malloc(payloadSizeBits * sizeof(uint8_t *) + payloadSizeBits * crcPolynomialSize * sizeof(uint8_t));
|
malloc_or_fail(payloadSizeBits * sizeof(uint8_t *) + payloadSizeBits * crcPolynomialSize * sizeof(uint8_t));
|
||||||
if (crc_generator_matrix)
|
if (crc_generator_matrix)
|
||||||
for (int i = 0; i < payloadSizeBits; i++)
|
for (int i = 0; i < payloadSizeBits; i++)
|
||||||
crc_generator_matrix[i] = ((uint8_t *)&crc_generator_matrix[payloadSizeBits]) + i * crcPolynomialSize;
|
crc_generator_matrix[i] = ((uint8_t *)&crc_generator_matrix[payloadSizeBits]) + i * crcPolynomialSize;
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
|
|||||||
PHY_VARS_UE *UE;
|
PHY_VARS_UE *UE;
|
||||||
RU_t *ru;
|
RU_t *ru;
|
||||||
printf("Start lte_param_init\n");
|
printf("Start lte_param_init\n");
|
||||||
*eNBp = malloc(sizeof(PHY_VARS_eNB));
|
*eNBp = malloc_or_fail(sizeof(PHY_VARS_eNB));
|
||||||
*UEp = malloc(sizeof(PHY_VARS_UE));
|
*UEp = malloc_or_fail(sizeof(PHY_VARS_UE));
|
||||||
*rup = malloc(sizeof(RU_t));
|
*rup = malloc_or_fail(sizeof(RU_t));
|
||||||
eNB = *eNBp;
|
eNB = *eNBp;
|
||||||
UE = *UEp;
|
UE = *UEp;
|
||||||
ru = *rup;
|
ru = *rup;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ data storage. */
|
|||||||
#include <lapacke_utils.h>
|
#include <lapacke_utils.h>
|
||||||
#include <lapacke.h>
|
#include <lapacke.h>
|
||||||
//#define DEBUG_PREPROC
|
//#define DEBUG_PREPROC
|
||||||
|
#include "common/utils/utils.h"
|
||||||
|
|
||||||
void transpose (int N, float complex *A, float complex *Result)
|
void transpose (int N, float complex *A, float complex *Result)
|
||||||
{
|
{
|
||||||
@@ -43,14 +43,14 @@ void transpose (int N, float complex *A, float complex *Result)
|
|||||||
int ldb = col_opB;
|
int ldb = col_opB;
|
||||||
|
|
||||||
if (transb == CblasNoTrans) {
|
if (transb == CblasNoTrans) {
|
||||||
B = (float complex*)calloc(ldb*col_opB,sizeof(float complex));
|
B = calloc_or_fail(ldb * col_opB, sizeof(float complex));
|
||||||
col_B= col_opB;
|
col_B= col_opB;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
B = (float complex*)calloc(ldb*col_opA, sizeof(float complex));
|
B = calloc_or_fail(ldb * col_opA, sizeof(float complex));
|
||||||
col_B = col_opA;
|
col_B = col_opA;
|
||||||
}
|
}
|
||||||
float complex* C = (float complex*)malloc(ldc*col_opB*sizeof(float complex));
|
float complex* C = malloc_or_fail(ldc * col_opB * sizeof(float complex));
|
||||||
|
|
||||||
for (i=0; i<lda*col_B; i+=N+1)
|
for (i=0; i<lda*col_B; i+=N+1)
|
||||||
B[i]=1.0+I*0;
|
B[i]=1.0+I*0;
|
||||||
@@ -82,14 +82,14 @@ void conjugate_transpose (int N, float complex *A, float complex *Result)
|
|||||||
int ldb = col_opB;
|
int ldb = col_opB;
|
||||||
|
|
||||||
if (transb == CblasNoTrans) {
|
if (transb == CblasNoTrans) {
|
||||||
B = (float complex*)calloc(ldb*col_opB,sizeof(float complex));
|
B = calloc_or_fail(ldb * col_opB, sizeof(float complex));
|
||||||
col_B= col_opB;
|
col_B= col_opB;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
B = (float complex*)calloc(ldb*col_opA, sizeof(float complex));
|
B = calloc_or_fail(ldb * col_opA, sizeof(float complex));
|
||||||
col_B = col_opA;
|
col_B = col_opA;
|
||||||
}
|
}
|
||||||
float complex* C = (float complex*)malloc(ldc*col_opB*sizeof(float complex));
|
float complex* C = malloc_or_fail(ldc * col_opB * sizeof(float complex));
|
||||||
|
|
||||||
for (i=0; i<lda*col_B; i+=N+1)
|
for (i=0; i<lda*col_B; i+=N+1)
|
||||||
B[i]=1.0+I*0;
|
B[i]=1.0+I*0;
|
||||||
@@ -117,7 +117,7 @@ void H_hermH_plus_sigma2I (int N, int M, float complex *A, float sigma2, float c
|
|||||||
int ldc = col_opA;
|
int ldc = col_opA;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
float complex* C = (float complex*)calloc(ldc*col_opB, sizeof(float complex));
|
float complex* C = calloc_or_fail(ldc * col_opB, sizeof(float complex));
|
||||||
|
|
||||||
for (i=0; i<lda*col_C; i+=N+1)
|
for (i=0; i<lda*col_C; i+=N+1)
|
||||||
C[i]=sigma2*(1.0+I*0);
|
C[i]=sigma2*(1.0+I*0);
|
||||||
@@ -141,7 +141,7 @@ void H_hermH_plus_sigma2I (int N, int M, float complex *A, float sigma2, float c
|
|||||||
int ldc = M;
|
int ldc = M;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
float complex* C = (float complex*)calloc(M*M, sizeof(float complex));
|
float complex* C = calloc_or_fail(M * M, sizeof(float complex));
|
||||||
|
|
||||||
for (i=0; i<M*M; i+=M+1)
|
for (i=0; i<M*M; i+=M+1)
|
||||||
C[i]=1.0+I*0;
|
C[i]=1.0+I*0;
|
||||||
@@ -163,7 +163,7 @@ void eigen_vectors_values (int N, float complex *A, float complex *Vectors, floa
|
|||||||
int order_A = N;
|
int order_A = N;
|
||||||
int lda = N;
|
int lda = N;
|
||||||
int i;
|
int i;
|
||||||
float* Values = (float*)malloc(sizeof(float)*1*N);
|
float* Values = malloc_or_fail(sizeof(float) * 1 * N);
|
||||||
|
|
||||||
LAPACKE_cheev(LAPACK_ROW_MAJOR, jobz, uplo, order_A, A, lda, Values);
|
LAPACKE_cheev(LAPACK_ROW_MAJOR, jobz, uplo, order_A, A, lda, Values);
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ void eigen_vectors_values (int N, float complex *A, float complex *Vectors, floa
|
|||||||
int nrhs = N;
|
int nrhs = N;
|
||||||
|
|
||||||
char transa = 'N';
|
char transa = 'N';
|
||||||
int* IPIV = malloc(N*N*sizeof(int));
|
int* IPIV = malloc_or_fail(N * N * sizeof(int));
|
||||||
|
|
||||||
// Compute LU-factorization
|
// Compute LU-factorization
|
||||||
LAPACKE_cgetrf(LAPACK_ROW_MAJOR, n, nrhs, A, lda, IPIV);
|
LAPACKE_cgetrf(LAPACK_ROW_MAJOR, n, nrhs, A, lda, IPIV);
|
||||||
@@ -267,8 +267,8 @@ void mutl_matrix_matrix_col_based(float complex* M0, float complex* M1, int rows
|
|||||||
void compute_MMSE(float complex* H, int order_H, float sigma2, float complex* W_MMSE)
|
void compute_MMSE(float complex* H, int order_H, float sigma2, float complex* W_MMSE)
|
||||||
{
|
{
|
||||||
int N = order_H;
|
int N = order_H;
|
||||||
float complex* H_hermH_sigmaI = malloc(N*N*sizeof(float complex));
|
float complex* H_hermH_sigmaI = malloc_or_fail(N * N * sizeof(float complex));
|
||||||
float complex* H_herm = malloc(N*N*sizeof(float complex));
|
float complex* H_herm = malloc_or_fail(N * N * sizeof(float complex));
|
||||||
|
|
||||||
H_hermH_plus_sigma2I(N, N, H, sigma2, H_hermH_sigmaI);
|
H_hermH_plus_sigma2I(N, N, H, sigma2, H_hermH_sigmaI);
|
||||||
|
|
||||||
@@ -309,18 +309,18 @@ void compute_white_filter(float complex* H_re,
|
|||||||
int N = n_tx;
|
int N = n_tx;
|
||||||
int sigma2=noise_power;
|
int sigma2=noise_power;
|
||||||
|
|
||||||
float complex *H0_re = malloc(n_rx*(n_tx>>2)*sizeof(float complex));
|
float complex *H0_re = malloc_or_fail(n_rx*(n_tx>>2)*sizeof(float complex));
|
||||||
float complex *H1_re = malloc(n_rx*(n_tx>>2)*sizeof(float complex));
|
float complex *H1_re = malloc_or_fail(n_rx*(n_tx>>2)*sizeof(float complex));
|
||||||
float complex *R_corr_col_n_0_re = malloc(n_rx*n_tx*sizeof(float complex));
|
float complex *R_corr_col_n_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex));
|
||||||
float complex *R_corr_col_n_1_re = malloc(n_rx*n_tx*sizeof(float complex));
|
float complex *R_corr_col_n_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex));
|
||||||
float complex *U_0_re = malloc(n_rx*n_tx*sizeof(float complex));
|
float complex *U_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex));
|
||||||
float complex *U_1_re = malloc(n_rx*n_tx*sizeof(float complex));
|
float complex *U_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex));
|
||||||
float complex *U_0_herm_re = malloc(n_rx*n_tx*sizeof(float complex));
|
float complex *U_0_herm_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex));
|
||||||
float complex *U_1_herm_re = malloc(n_rx*n_tx*sizeof(float complex));
|
float complex *U_1_herm_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex));
|
||||||
float complex *D_0_re = malloc(n_rx*n_tx*sizeof(float complex));
|
float complex *D_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex));
|
||||||
float complex *D_1_re = malloc(n_rx*n_tx*sizeof(float complex));
|
float complex *D_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex));
|
||||||
float complex *W_Wh_0_re = malloc(n_rx*n_tx*sizeof(float complex));
|
float complex *W_Wh_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex));
|
||||||
float complex *W_Wh_1_re = malloc(n_rx*n_tx*sizeof(float complex));
|
float complex *W_Wh_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex));
|
||||||
|
|
||||||
for (aatx=0; aatx<n_tx/2; aatx++){
|
for (aatx=0; aatx<n_tx/2; aatx++){
|
||||||
for (aarx=0; aarx<n_rx; aarx++) {
|
for (aarx=0; aarx<n_rx; aarx++) {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ static void drawsymbol(FL_OBJECT *obj, int id,
|
|||||||
static void commonGraph(OAIgraph_t *graph, int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) {
|
static void commonGraph(OAIgraph_t *graph, int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) {
|
||||||
if (type==WATERFALL) {
|
if (type==WATERFALL) {
|
||||||
graph->waterFallh=h-15;
|
graph->waterFallh=h-15;
|
||||||
graph->waterFallAvg=malloc(sizeof(*graph->waterFallAvg) * graph->waterFallh);
|
graph->waterFallAvg = malloc_or_fail(sizeof(*graph->waterFallAvg) * graph->waterFallh);
|
||||||
|
|
||||||
for (int i=0; i< graph->waterFallh; i++)
|
for (int i=0; i< graph->waterFallh; i++)
|
||||||
graph->waterFallAvg[i]=0;
|
graph->waterFallAvg[i]=0;
|
||||||
@@ -309,7 +309,7 @@ static void puschIQ (OAIgraph_t *graph, calibData_t *context) {
|
|||||||
|
|
||||||
static OAI_phy_scope_t *createScopeCalibration(calibData_t * context) {
|
static OAI_phy_scope_t *createScopeCalibration(calibData_t * context) {
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT *obj;
|
||||||
OAI_phy_scope_t *fdui = calloc(( sizeof *fdui ),1);
|
OAI_phy_scope_t *fdui = calloc_or_fail((sizeof *fdui), 1);
|
||||||
fdui->context=context;
|
fdui->context=context;
|
||||||
// Define form
|
// Define form
|
||||||
fdui->phy_scope = fl_bgn_form( FL_NO_BOX, 800, 800 );
|
fdui->phy_scope = fl_bgn_form( FL_NO_BOX, 800, 800 );
|
||||||
@@ -380,7 +380,7 @@ static void *scopeThread(void *arg) {
|
|||||||
|
|
||||||
void CalibrationInitScope(void ** samplesRx,openair0_device *rfdevice) {
|
void CalibrationInitScope(void ** samplesRx,openair0_device *rfdevice) {
|
||||||
pthread_t forms_thread;
|
pthread_t forms_thread;
|
||||||
calibData_t * tmp=(calibData_t *) malloc(sizeof(*tmp));
|
calibData_t *tmp = (calibData_t *)malloc_or_fail(sizeof(*tmp));
|
||||||
tmp->samplesRx=samplesRx;
|
tmp->samplesRx=samplesRx;
|
||||||
tmp->rfdevice=rfdevice;
|
tmp->rfdevice=rfdevice;
|
||||||
threadCreate(&forms_thread, scopeThread, (void*) tmp, "scope", -1, OAI_PRIORITY_RT_LOW);
|
threadCreate(&forms_thread, scopeThread, (void*) tmp, "scope", -1, OAI_PRIORITY_RT_LOW);
|
||||||
|
|||||||
@@ -614,7 +614,7 @@ static void puschThroughtput (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) {
|
|||||||
STATICFORXSCOPE OAI_phy_scope_t *create_phy_scope_gnb(void)
|
STATICFORXSCOPE OAI_phy_scope_t *create_phy_scope_gnb(void)
|
||||||
{
|
{
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT *obj;
|
||||||
OAI_phy_scope_t *fdui = calloc(( sizeof *fdui ),1);
|
OAI_phy_scope_t *fdui = calloc_or_fail((sizeof *fdui), 1);
|
||||||
// Define form
|
// Define form
|
||||||
fdui->phy_scope = fl_bgn_form( FL_NO_BOX, 800, 800 );
|
fdui->phy_scope = fl_bgn_form( FL_NO_BOX, 800, 800 );
|
||||||
fl_set_form_dblbuffer(fdui->phy_scope, 1);
|
fl_set_form_dblbuffer(fdui->phy_scope, 1);
|
||||||
@@ -739,7 +739,7 @@ static void scopeUpdaterGnb(enum PlotTypeGnbIf plotType, int numElt)
|
|||||||
|
|
||||||
STATICFORXSCOPE void gNBinitScope(scopeParms_t *p)
|
STATICFORXSCOPE void gNBinitScope(scopeParms_t *p)
|
||||||
{
|
{
|
||||||
AssertFatal(p->gNB->scopeData = calloc(sizeof(scopeData_t), 1), "");
|
AssertFatal(p->gNB->scopeData = calloc_or_fail(sizeof(scopeData_t), 1), "");
|
||||||
scopeData_t *scope=(scopeData_t *) p->gNB->scopeData;
|
scopeData_t *scope=(scopeData_t *) p->gNB->scopeData;
|
||||||
scope->argc=p->argc;
|
scope->argc=p->argc;
|
||||||
scope->argv=p->argv;
|
scope->argv=p->argv;
|
||||||
@@ -998,7 +998,7 @@ static void uePdschThroughput (scopeGraphData_t **data, OAIgraph_t *graph, PHY_
|
|||||||
STATICFORXSCOPE OAI_phy_scope_t *create_phy_scope_nrue(int ID)
|
STATICFORXSCOPE OAI_phy_scope_t *create_phy_scope_nrue(int ID)
|
||||||
{
|
{
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT *obj;
|
||||||
OAI_phy_scope_t *fdui = calloc(( sizeof *fdui ),1);
|
OAI_phy_scope_t *fdui = calloc_or_fail((sizeof *fdui), 1);
|
||||||
// Define form
|
// Define form
|
||||||
fdui->phy_scope = fl_bgn_form( FL_NO_BOX, 800, 900 );
|
fdui->phy_scope = fl_bgn_form( FL_NO_BOX, 800, 900 );
|
||||||
fl_set_form_dblbuffer(fdui->phy_scope, 1);
|
fl_set_form_dblbuffer(fdui->phy_scope, 1);
|
||||||
@@ -1139,7 +1139,7 @@ static void *nrUEscopeThread(void *arg) {
|
|||||||
|
|
||||||
STATICFORXSCOPE void nrUEinitScope(PHY_VARS_NR_UE *ue)
|
STATICFORXSCOPE void nrUEinitScope(PHY_VARS_NR_UE *ue)
|
||||||
{
|
{
|
||||||
AssertFatal(ue->scopeData = calloc(sizeof(scopeData_t), 1), "");
|
AssertFatal(ue->scopeData = calloc_or_fail(sizeof(scopeData_t), 1), "");
|
||||||
scopeData_t *scope=(scopeData_t *) ue->scopeData;
|
scopeData_t *scope=(scopeData_t *) ue->scopeData;
|
||||||
scope->copyData = copyData;
|
scope->copyData = copyData;
|
||||||
#ifndef WEBSRVSCOPE
|
#ifndef WEBSRVSCOPE
|
||||||
@@ -1185,7 +1185,7 @@ static void reset_stats_gNB(FL_OBJECT *button,
|
|||||||
}
|
}
|
||||||
static FD_stats_form *create_form_stats_form(int ID) {
|
static FD_stats_form *create_form_stats_form(int ID) {
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT *obj;
|
||||||
FD_stats_form *fdui = calloc(( sizeof *fdui ),1);
|
FD_stats_form *fdui = calloc_or_fail(( sizeof *fdui ),1);
|
||||||
fdui->vdata = fdui->cdata = NULL;
|
fdui->vdata = fdui->cdata = NULL;
|
||||||
fdui->ldata = 0;
|
fdui->ldata = 0;
|
||||||
fdui->stats_form = fl_bgn_form( FL_NO_BOX, 1115, 900 );
|
fdui->stats_form = fl_bgn_form( FL_NO_BOX, 1115, 900 );
|
||||||
|
|||||||
Reference in New Issue
Block a user