Commit 3f2acf94 authored by Raphael Defosseux's avatar Raphael Defosseux

Fix Coverity Scan CID 342010

Fix a few cppcheck errors/warnings
Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent d2a6cca8
...@@ -826,7 +826,6 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, ...@@ -826,7 +826,6 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
} }
} }
free(ue_report); free(ue_report);
ue_report = NULL;
} }
return -1; return -1;
......
...@@ -235,7 +235,7 @@ rlc_am_receive_process_control_pdu( ...@@ -235,7 +235,7 @@ rlc_am_receive_process_control_pdu(
rlc_sn_t ack_sn = RLC_AM_NEXT_SN(rlc_pP->vt_a); rlc_sn_t ack_sn = RLC_AM_NEXT_SN(rlc_pP->vt_a);
rlc_sn_t sn_cursor = rlc_pP->vt_a; rlc_sn_t sn_cursor = rlc_pP->vt_a;
rlc_sn_t vt_a_new = rlc_pP->vt_a; rlc_sn_t vt_a_new = rlc_pP->vt_a;
rlc_sn_t sn_data_cnf; rlc_sn_t sn_data_cnf = (rlc_sn_t) 0;
rlc_sn_t nack_sn,prev_nack_sn; rlc_sn_t nack_sn,prev_nack_sn;
sdu_size_t data_cnf_so_stop = 0x7FFF; sdu_size_t data_cnf_so_stop = 0x7FFF;
unsigned int nack_index; unsigned int nack_index;
......
...@@ -267,7 +267,7 @@ int nas_message_decrypt( ...@@ -267,7 +267,7 @@ int nas_message_decrypt(
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
emm_security_context_t *emm_security_context = (emm_security_context_t*)security; emm_security_context_t *emm_security_context = NULL;
int bytes = length; int bytes = length;
/* Decode the header */ /* Decode the header */
...@@ -277,7 +277,8 @@ int nas_message_decrypt( ...@@ -277,7 +277,8 @@ int nas_message_decrypt(
LOG_TRACE(DEBUG, "MESSAGE TOO SHORT"); LOG_TRACE(DEBUG, "MESSAGE TOO SHORT");
LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT); LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT);
} else if (size > 1) { } else if (size > 1) {
if (emm_security_context) { if (security) {
emm_security_context = (emm_security_context_t*)security;
#if defined(NAS_MME) #if defined(NAS_MME)
if (emm_security_context->ul_count.seq_num > header->sequence_number) { if (emm_security_context->ul_count.seq_num > header->sequence_number) {
...@@ -376,7 +377,7 @@ int nas_message_decode( ...@@ -376,7 +377,7 @@ int nas_message_decode(
void *security) void *security)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
emm_security_context_t *emm_security_context = (emm_security_context_t*)security; emm_security_context_t *emm_security_context = NULL;
int bytes; int bytes;
/* Decode the header */ /* Decode the header */
...@@ -385,7 +386,8 @@ int nas_message_decode( ...@@ -385,7 +386,8 @@ int nas_message_decode(
if (size < 0) { if (size < 0) {
LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT); LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT);
} else if (size > 1) { } else if (size > 1) {
if (emm_security_context) { if (security) {
emm_security_context = (emm_security_context_t*)security;
#if defined(NAS_MME) #if defined(NAS_MME)
if (emm_security_context->ul_count.seq_num > msg->header.sequence_number) { if (emm_security_context->ul_count.seq_num > msg->header.sequence_number) {
...@@ -971,6 +973,8 @@ static int _nas_message_decrypt( ...@@ -971,6 +973,8 @@ static int _nas_message_decrypt(
#else #else
direction = SECU_DIRECTION_DOWNLINK; direction = SECU_DIRECTION_DOWNLINK;
#endif #endif
if (emm_security_context == NULL)
LOG_FUNC_RETURN (0);
switch (security_header_type) { switch (security_header_type) {
case SECURITY_HEADER_TYPE_NOT_PROTECTED: case SECURITY_HEADER_TYPE_NOT_PROTECTED:
......
...@@ -125,8 +125,15 @@ int main(int argc, char *argv[]) { ...@@ -125,8 +125,15 @@ int main(int argc, char *argv[]) {
fullwrite(serviceSock, &header, sizeof(header)); fullwrite(serviceSock, &header, sizeof(header));
int dataSize=sizeof(sample_t)*header.size*header.nbAnt; int dataSize=sizeof(sample_t)*header.size*header.nbAnt;
if (dataSize>bufSize) if (dataSize>bufSize) {
buff=realloc(buff,dataSize); void * new_buff = realloc(buff, dataSize);
if (new_buff == NULL) {
free(buff);
AssertFatal(1, "Could not reallocate");
} else {
buff = new_buff;
}
}
AssertFatal(read(fd,buff,dataSize) == dataSize, ""); AssertFatal(read(fd,buff,dataSize) == dataSize, "");
fullwrite(serviceSock, buff, dataSize); fullwrite(serviceSock, buff, dataSize);
......
...@@ -508,9 +508,9 @@ int wakeup_txfh(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc,int frame_tx,int subfram ...@@ -508,9 +508,9 @@ int wakeup_txfh(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc,int frame_tx,int subfram
if (((fp->frame_type == TDD) && (subframe_select(fp,proc->subframe_tx)==SF_UL))|| if (((fp->frame_type == TDD) && (subframe_select(fp,proc->subframe_tx)==SF_UL))||
(eNB->RU_list[ru_id]->state == RU_SYNC)|| (eNB->RU_list[ru_id]->state == RU_SYNC)||
(eNB->RU_list[ru_id]->wait_cnt>0)){ (eNB->RU_list[ru_id]->wait_cnt>0)){
AssertFatal((pthread_mutex_lock(&proc->mutex_RUs))==0, "mutex_lock returns %d\n",ret); AssertFatal((ret=pthread_mutex_lock(&proc->mutex_RUs))==0, "mutex_lock returns %d\n",ret);
proc->instance_cnt_RUs = 0; proc->instance_cnt_RUs = 0;
AssertFatal((pthread_mutex_unlock(&proc->mutex_RUs))==0, "mutex_unlock returns %d\n",ret); AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_RUs))==0, "mutex_unlock returns %d\n",ret);
continue;//hacking only works when all RU_tx works on the same subframe #TODO: adding mask stuff continue;//hacking only works when all RU_tx works on the same subframe #TODO: adding mask stuff
} }
......
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