several coverity high and medium impact fixes

master
Francisco 4 years ago committed by Francisco Paisana
parent 9a4fcb605b
commit 86dac9c823

@ -314,7 +314,7 @@ public:
const_iterator end() const { return &data_[size()]; }
private:
T data_[MAX_N];
T data_[MAX_N] = {};
uint32_t current_size;
};

@ -120,7 +120,9 @@ int open_socket(net_utils::addr_family ip_type, net_utils::socket_type socket_ty
evnts.sctp_address_event = 1;
if (setsockopt(fd, IPPROTO_SCTP, SCTP_EVENTS, &evnts, sizeof(evnts)) != 0) {
srslog::fetch_basic_logger(LOGSERVICE).error("Failed to subscribe to SCTP_SHUTDOWN event: %s", strerror(errno));
perror("Could not regiester socket to SCTP events\n");
perror("Could not register socket to SCTP events\n");
close(fd);
return -1;
}
/*
@ -134,6 +136,7 @@ int open_socket(net_utils::addr_family ip_type, net_utils::socket_type socket_ty
rto_opts.srto_assoc_id = 0;
if (getsockopt(fd, SOL_SCTP, SCTP_RTOINFO, &rto_opts, &rto_sz) < 0) {
printf("Error getting RTO_INFO sockopts\n");
close(fd);
return -1;
}
@ -149,6 +152,7 @@ int open_socket(net_utils::addr_family ip_type, net_utils::socket_type socket_ty
if (setsockopt(fd, SOL_SCTP, SCTP_RTOINFO, &rto_opts, rto_sz) < 0) {
perror("Error setting RTO_INFO sockopts\n");
close(fd);
return -1;
}
@ -157,6 +161,8 @@ int open_socket(net_utils::addr_family ip_type, net_utils::socket_type socket_ty
socklen_t init_sz = sizeof(sctp_initmsg);
if (getsockopt(fd, SOL_SCTP, SCTP_INITMSG, &init_opts, &init_sz) < 0) {
printf("Error getting sockopts\n");
close(fd);
return -1;
}
init_opts.sinit_max_attempts = 3;
@ -168,6 +174,7 @@ int open_socket(net_utils::addr_family ip_type, net_utils::socket_type socket_ty
init_opts.sinit_max_init_timeo);
if (setsockopt(fd, SOL_SCTP, SCTP_INITMSG, &init_opts, init_sz) < 0) {
perror("Error setting SCTP_INITMSG sockopts\n");
close(fd);
return -1;
}
}

@ -279,7 +279,7 @@ private:
srsran::unique_timer ts1_reloc_overall; ///< TS1_{RELOCOverall}
// Procedure state
s1ap_proc_id_t current_state;
s1ap_proc_id_t current_state = s1ap_proc_id_t::nulltype;
erab_id_list updated_erabs;
srsran::bounded_vector<asn1::s1ap::erab_item_s, ASN1_S1AP_MAXNOOF_ERABS> failed_cfg_erabs;

@ -759,8 +759,7 @@ bool gtpu::send_end_marker(uint32_t teidin)
servaddr.sin_addr.s_addr = htonl(tx_tun->spgw_addr);
servaddr.sin_port = htons(GTPU_PORT);
sendto(fd, pdu->msg, pdu->N_bytes, MSG_EOR, (struct sockaddr*)&servaddr, sizeof(struct sockaddr_in));
return true;
return sendto(fd, pdu->msg, pdu->N_bytes, MSG_EOR, (struct sockaddr*)&servaddr, sizeof(struct sockaddr_in)) > 0;
}
/****************************************************************************

@ -1164,6 +1164,10 @@ bool s1ap::send_ho_req_ack(const asn1::s1ap::ho_request_s& msg,
ho_request_ack_ies_container& container = tx_pdu.successful_outcome().value.ho_request_ack().protocol_ies;
ue* ue_ptr = users.find_ue_mmeid(msg.protocol_ies.mme_ue_s1ap_id.value.value);
if (ue_ptr == nullptr) {
logger.error("The MME-S1AP-UE-ID=%ld is not valid", msg.protocol_ies.mme_ue_s1ap_id.value.value);
return false;
}
ue_ptr->ctxt.rnti = rnti;
ue_ptr->ctxt.enb_cc_idx = enb_cc_idx;

Loading…
Cancel
Save