fixing uninitialized class members found by coverity

master
Andre Puschmann 6 years ago committed by Pedro Alvarez
parent 6b2961fcee
commit 5faa819dcd

@ -24,15 +24,13 @@
namespace srsenb {
pdcp::pdcp(srslte::log* log_) : log_h(log_) {}
pdcp::pdcp(srslte::log* log_) : log_h(log_), pool(srslte::byte_buffer_pool::get_instance()) {}
void pdcp::init(rlc_interface_pdcp* rlc_, rrc_interface_pdcp* rrc_, gtpu_interface_pdcp* gtpu_)
{
rlc = rlc_;
rrc = rrc_;
gtpu = gtpu_;
pool = srslte::byte_buffer_pool::get_instance();
pthread_rwlock_init(&rwlock, NULL);
}

@ -259,29 +259,29 @@ public:
bool expire_timer(enum nas_timer_type type);
/* UE Context */
emm_ctx_t m_emm_ctx;
ecm_ctx_t m_ecm_ctx;
esm_ctx_t m_esm_ctx[MAX_ERABS_PER_UE];
sec_ctx_t m_sec_ctx;
emm_ctx_t m_emm_ctx = {};
ecm_ctx_t m_ecm_ctx = {};
esm_ctx_t m_esm_ctx[MAX_ERABS_PER_UE] = {};
sec_ctx_t m_sec_ctx = {};
private:
srslte::byte_buffer_pool* m_pool;
srslte::log* m_nas_log;
gtpc_interface_nas* m_gtpc;
s1ap_interface_nas* m_s1ap;
hss_interface_nas* m_hss;
mme_interface_nas* m_mme;
uint16_t m_mcc;
uint16_t m_mnc;
uint16_t m_mme_group;
uint16_t m_mme_code;
uint16_t m_tac;
srslte::byte_buffer_pool* m_pool = nullptr;
srslte::log* m_nas_log = nullptr;
gtpc_interface_nas* m_gtpc = nullptr;
s1ap_interface_nas* m_s1ap = nullptr;
hss_interface_nas* m_hss = nullptr;
mme_interface_nas* m_mme = nullptr;
uint16_t m_mcc = 0;
uint16_t m_mnc = 0;
uint16_t m_mme_group = 0;
uint16_t m_mme_code = 0;
uint16_t m_tac = 0;
std::string m_apn;
std::string m_dns;
// Timers timeout values
uint16_t m_t3413;
uint16_t m_t3413 = 0;
// Timer functions
bool start_t3413();

@ -160,7 +160,7 @@ private:
srslte::mch_pdu mch_msg;
/* Functions for MAC Timers */
uint32_t timer_alignment;
uint32_t timer_alignment = 0;
void setup_timers(int time_alignment_timer);
void timer_alignment_expire();
srslte::timers timers;

@ -357,21 +357,21 @@ private:
uint16_t lcid;
} cmd_msg_t;
bool running;
bool running = false;
srslte::block_queue<cmd_msg_t> cmd_q;
void run_thread();
void process_pcch(srslte::unique_byte_buffer_t pdu);
srslte::byte_buffer_pool *pool;
srslte::log *rrc_log;
phy_interface_rrc_lte* phy;
mac_interface_rrc *mac;
rlc_interface_rrc *rlc;
pdcp_interface_rrc *pdcp;
nas_interface_rrc *nas;
usim_interface_rrc *usim;
gw_interface_rrc *gw;
srslte::byte_buffer_pool* pool = nullptr;
srslte::log* rrc_log = nullptr;
phy_interface_rrc_lte* phy = nullptr;
mac_interface_rrc* mac = nullptr;
rlc_interface_rrc* rlc = nullptr;
pdcp_interface_rrc* pdcp = nullptr;
nas_interface_rrc* nas = nullptr;
usim_interface_rrc* usim = nullptr;
gw_interface_rrc* gw = nullptr;
srslte::unique_byte_buffer_t dedicated_info_nas;
@ -382,40 +382,40 @@ private:
pthread_mutex_t mutex;
rrc_state_t state, last_state;
uint8_t transaction_id;
rrc_state_t state, last_state = RRC_STATE_IDLE;
uint8_t transaction_id = 0;
srslte::s_tmsi_t ue_identity;
bool ue_identity_configured;
bool ue_identity_configured = false;
bool drb_up;
bool drb_up = false;
rrc_args_t args;
rrc_args_t args = {};
uint32_t cell_clean_cnt;
uint32_t cell_clean_cnt = 0;
uint16_t ho_src_rnti;
cell_t ho_src_cell;
phy_interface_rrc_lte::phy_cfg_t current_phy_cfg, previous_phy_cfg;
mac_interface_rrc::mac_cfg_t current_mac_cfg, previous_mac_cfg;
bool pending_mob_reconf;
asn1::rrc::rrc_conn_recfg_s mob_reconf;
uint16_t ho_src_rnti = 0;
cell_t ho_src_cell = {};
phy_interface_rrc_lte::phy_cfg_t current_phy_cfg, previous_phy_cfg = {};
mac_interface_rrc::mac_cfg_t current_mac_cfg, previous_mac_cfg = {};
bool pending_mob_reconf = false;
asn1::rrc::rrc_conn_recfg_s mob_reconf = {};
uint8_t k_rrc_enc[32];
uint8_t k_rrc_int[32];
uint8_t k_up_enc[32];
uint8_t k_up_int[32]; // Not used: only for relay nodes (3GPP 33.401 Annex A.7)
uint8_t k_rrc_enc[32] = {};
uint8_t k_rrc_int[32] = {};
uint8_t k_up_enc[32] = {};
uint8_t k_up_int[32] = {}; // Not used: only for relay nodes (3GPP 33.401 Annex A.7)
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo;
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo;
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo = srslte::CIPHERING_ALGORITHM_ID_EEA0;
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo = srslte::INTEGRITY_ALGORITHM_ID_EIA0;
std::map<uint32_t, asn1::rrc::srb_to_add_mod_s> srbs;
std::map<uint32_t, asn1::rrc::drb_to_add_mod_s> drbs;
// RRC constants and timers
srslte::mac_interface_timers *mac_timers;
uint32_t n310_cnt, N310;
uint32_t n311_cnt, N311;
uint32_t t300, t301, t302, t310, t311, t304;
srslte::mac_interface_timers* mac_timers = nullptr;
uint32_t n310_cnt, N310 = 0;
uint32_t n311_cnt, N311 = 0;
uint32_t t300, t301, t302, t310, t311, t304 = 0;
// Radio bearers
typedef enum{
@ -448,7 +448,7 @@ private:
const static int NEIGHBOUR_TIMEOUT = 5;
const static int NOF_NEIGHBOUR_CELLS = 8;
std::vector<cell_t*> neighbour_cells;
cell_t *serving_cell;
cell_t* serving_cell = nullptr;
void set_serving_cell(uint32_t cell_idx);
void set_serving_cell(phy_interface_rrc_lte::phy_cell_t phy_cell);
@ -467,16 +467,16 @@ private:
uint32_t sib_start_tti(uint32_t tti, uint32_t period, uint32_t offset, uint32_t sf);
const static int SIB_SEARCH_TIMEOUT_MS = 1000;
bool initiated;
bool ho_start;
bool go_idle;
asn1::rrc::reest_cause_e m_reest_cause;
uint16_t m_reest_rnti;
bool initiated = false;
bool ho_start = false;
bool go_idle = false;
asn1::rrc::reest_cause_e m_reest_cause = {};
uint16_t m_reest_rnti = 0;
bool reestablishment_started = false;
bool reestablishment_successful = false;
uint32_t rlc_flush_counter;
uint32_t rlc_flush_timeout;
uint32_t rlc_flush_counter = 0;
uint32_t rlc_flush_timeout = 0;
// Measurements sub-class
class rrc_meas {
@ -539,18 +539,18 @@ private:
std::map<uint32_t, report_cfg_t> reports_cfg;
std::map<uint32_t, meas_t> active;
rrc *parent;
srslte::log *log_h;
phy_interface_rrc_lte* phy;
srslte::mac_interface_timers *mac_timers;
rrc* parent = nullptr;
srslte::log* log_h = nullptr;
phy_interface_rrc_lte* phy = nullptr;
srslte::mac_interface_timers* mac_timers = nullptr;
uint32_t filter_k_rsrp, filter_k_rsrq;
float filter_a[NOF_MEASUREMENTS];
uint32_t filter_k_rsrp, filter_k_rsrq = 0;
float filter_a[NOF_MEASUREMENTS] = {};
meas_value_t pcell_measurement;
meas_value_t pcell_measurement = {};
bool s_measure_enabled;
float s_measure_value;
bool s_measure_enabled = false;
float s_measure_value = 0.0;
void stop_reports(meas_t *m);
void stop_reports_object(uint32_t object_id);
@ -600,7 +600,7 @@ private:
float threshservinglow;
} cell_resel_cfg_t;
cell_resel_cfg_t cell_resel_cfg;
cell_resel_cfg_t cell_resel_cfg = {};
float get_srxlev(float Qrxlevmeas);
float get_squal(float Qqualmeas);
@ -617,10 +617,10 @@ private:
phy_interface_rrc_lte::cell_search_ret_t cell_search();
srslte::plmn_id_t selected_plmn_id;
bool plmn_is_selected;
srslte::plmn_id_t selected_plmn_id = {};
bool plmn_is_selected = false;
bool security_is_activated;
bool security_is_activated = false;
// RLC interface
void max_retx_attempted();

@ -43,10 +43,7 @@ class nas
{
public:
nas(srslte::log* log_);
void init(usim_interface_nas* usim_,
rrc_interface_nas* rrc_,
gw_interface_nas* gw_,
nas_args_t args_);
void init(usim_interface_nas* usim_, rrc_interface_nas* rrc_, gw_interface_nas* gw_, const nas_args_t& args_);
void stop();
void get_metrics(nas_metrics_t* m);
@ -71,19 +68,19 @@ public:
void start_pcap(srslte::nas_pcap *pcap_);
private:
srslte::byte_buffer_pool *pool;
srslte::log *nas_log;
rrc_interface_nas *rrc;
usim_interface_nas *usim;
gw_interface_nas *gw;
srslte::byte_buffer_pool* pool = nullptr;
srslte::log* nas_log = nullptr;
rrc_interface_nas* rrc = nullptr;
usim_interface_nas* usim = nullptr;
gw_interface_nas* gw = nullptr;
nas_args_t cfg;
nas_args_t cfg = {};
emm_state_t state;
emm_state_t state = EMM_STATE_DEREGISTERED;
nas_interface_rrc::barring_t current_barring;
nas_interface_rrc::barring_t current_barring = BARRING_NONE;
bool plmn_is_selected;
bool plmn_is_selected = false;
srslte::plmn_id_t current_plmn;
srslte::plmn_id_t home_plmn;
@ -115,28 +112,28 @@ private:
typedef std::pair<uint8_t, eps_bearer_t> eps_bearer_map_pair_t;
eps_bearer_map_t eps_bearer;
bool have_guti;
bool have_ctxt;
nas_sec_ctxt ctxt;
bool auth_request;
bool have_guti = false;
bool have_ctxt = false;
nas_sec_ctxt ctxt = {};
bool auth_request = false;
uint32_t ip_addr;
uint8_t ipv6_if_id[8];
uint32_t ip_addr = 0;
uint8_t ipv6_if_id[8] = {};
uint8_t chap_id;
uint8_t chap_id = 0;
uint8_t transaction_id;
uint8_t transaction_id = 0;
// Security
bool eia_caps[8];
bool eea_caps[8];
uint8_t k_nas_enc[32];
uint8_t k_nas_int[32];
bool eia_caps[8] = {};
bool eea_caps[8] = {};
uint8_t k_nas_enc[32] = {};
uint8_t k_nas_int[32] = {};
// PCAP
srslte::nas_pcap *pcap = NULL;
srslte::nas_pcap* pcap = nullptr;
bool running;
bool running = false;
bool rrc_connect();

@ -99,38 +99,37 @@ private:
uint8_t *k_asme);
void str_to_hex(std::string str, uint8_t *hex);
srslte::log *usim_log;
srslte::log* usim_log = nullptr;
// User data
auth_algo_t auth_algo;
uint8_t amf[2]; // 3GPP 33.102 v10.0.0 Annex H
uint8_t op[16];
uint8_t opc[16];
uint64_t imsi;
uint64_t imei;
uint8_t k[16];
auth_algo_t auth_algo = auth_algo_milenage;
uint8_t amf[2] = {}; // 3GPP 33.102 v10.0.0 Annex H
uint8_t op[16] = {};
uint8_t opc[16] = {};
uint64_t imsi = 0;
uint64_t imei = 0;
uint8_t k[16] = {};
std::string imsi_str;
std::string imei_str;
// Security variables
uint8_t rand[16];
uint8_t ck[16];
uint8_t ik[16];
uint8_t ak[6];
uint8_t mac[8];
uint8_t autn[16];
uint8_t k_asme[32];
uint8_t nh[32];
uint8_t k_enb_initial[32];
uint8_t k_enb[32];
uint8_t k_enb_star[32];
uint32_t current_ncc;
bool is_first_ncc;
bool initiated;
uint8_t rand[16] = {};
uint8_t ck[16] = {};
uint8_t ik[16] = {};
uint8_t ak[6] = {};
uint8_t mac[8] = {};
uint8_t autn[16] = {};
uint8_t k_asme[32] = {};
uint8_t nh[32] = {};
uint8_t k_enb_initial[32] = {};
uint8_t k_enb[32] = {};
uint8_t k_enb_star[32] = {};
uint32_t current_ncc = 0;
bool is_first_ncc = false;
bool initiated = false;
};
} // namespace srsue

@ -47,6 +47,8 @@ void mux::init(rlc_interface_mac* rlc_, bsr_interface_mux* bsr_procedure_, phr_p
void mux::reset()
{
std::lock_guard<std::mutex> lock(mutex);
for (auto& channel : logical_channels) {
channel.Bj = 0;
}
@ -265,7 +267,7 @@ void mux::append_crnti_ce_next_tx(uint16_t crnti) {
bool mux::sched_sdu(logical_channel_config_t* ch, int* sdu_space, int max_sdu_sz)
{
if (*sdu_space > 0) {
if (sdu_space != nullptr && *sdu_space > 0) {
// Get n-th pending SDU pointer and length
int sched_len = ch->buffer_len;
if (sched_len > 0) { // there is pending SDU to allocate

@ -42,28 +42,10 @@ namespace srsue {
* NAS
********************************************************************/
nas::nas(srslte::log* log_) :
nas_log(log_),
state(EMM_STATE_DEREGISTERED),
have_guti(false),
have_ctxt(false),
auth_request(false),
ip_addr(0)
{
ctxt.rx_count = 0;
ctxt.tx_count = 0;
ctxt.cipher_algo = CIPHERING_ALGORITHM_ID_EEA0;
ctxt.integ_algo = INTEGRITY_ALGORITHM_ID_EIA0;
plmn_is_selected = false;
chap_id = 0;
memset(ipv6_if_id, 0, sizeof(ipv6_if_id));
bzero(eia_caps, sizeof(eia_caps));
bzero(eea_caps, sizeof(eea_caps));
}
nas::nas(srslte::log* log_) : nas_log(log_), pool(byte_buffer_pool::get_instance()) {}
void nas::init(usim_interface_nas* usim_, rrc_interface_nas* rrc_, gw_interface_nas* gw_, nas_args_t cfg_)
void nas::init(usim_interface_nas* usim_, rrc_interface_nas* rrc_, gw_interface_nas* gw_, const nas_args_t& cfg_)
{
pool = byte_buffer_pool::get_instance();
usim = usim_;
rrc = rrc_;
gw = gw_;

@ -28,7 +28,7 @@ using namespace asn1::rrc;
namespace srsue{
usim::usim(srslte::log* log_) : usim_log(log_), initiated(false) {}
usim::usim(srslte::log* log_) : usim_log(log_) {}
int usim::init(usim_args_t* args)
{

Loading…
Cancel
Save