aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-07-03 11:45:27 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-07-12 23:42:47 +0200
commitf5dfb3fc737b6e13ea5a74774aaff5dc603f4b46 (patch)
treee60249b6d1b2d2a329841669ff529d5bd1c324dd
parent5d9aad0ec3281d3e1f64698b1cda692950296d03 (diff)
osmo-msc/a_iface: add missing assertions
-rw-r--r--src/libmsc/a_iface.c12
-rw-r--r--src/libmsc/a_iface_bssap.c10
2 files changed, 22 insertions, 0 deletions
diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c
index f19e9d53..5ca631d0 100644
--- a/src/libmsc/a_iface.c
+++ b/src/libmsc/a_iface.c
@@ -154,6 +154,9 @@ int a_iface_tx_cipher_mode(struct gsm_subscriber_connection *conn,
/* TODO generalize for A- and Iu interfaces, don't name after 08.08 */
struct msgb *msg_resp;
struct gsm0808_encrypt_info ei;
+
+ OSMO_ASSERT(conn);
+
LOGP(DMSC, LOGL_DEBUG, "Passing Cipher mode command message from MSC to BSC (conn_id=%i)\n", conn->a.conn_id);
uint8_t crm = 0x01;
uint8_t *crm_ptr = NULL;
@@ -189,6 +192,8 @@ int a_iface_tx_paging(const char *imsi, uint32_t tmsi, uint16_t lac)
struct msgb *msg;
int page_count = 0;
+ OSMO_ASSERT(imsi);
+
cil.id_discr = CELL_IDENT_LAC;
cil.id_list_lac[0] = lac;
cil.id_list_len = 1;
@@ -294,6 +299,9 @@ int enc_channel_type(struct gsm0808_channel_type *ct, const struct gsm_mncc_bear
unsigned int count = 0;
bool only_gsm_hr = true;
+ OSMO_ASSERT(ct);
+ OSMO_ASSERT(bc);
+
ct->ch_indctr = GSM0808_CHAN_SPEECH;
for (i = 0; i < ARRAY_SIZE(bc->speech_ver); i++) {
@@ -358,6 +366,7 @@ int a_iface_tx_assignment(struct gsm_trans *trans)
struct sockaddr_in rtp_addr_in;
int rc;
+ OSMO_ASSERT(trans);
conn = trans->conn;
OSMO_ASSERT(conn);
@@ -507,6 +516,9 @@ void a_clear_all(struct osmo_sccp_user *scu, struct osmo_sccp_addr *bsc_addr)
struct gsm_subscriber_connection *conn_temp;
struct gsm_network *network = gsm_network;
+ OSMO_ASSERT(scu);
+ OSMO_ASSERT(bsc_addr);
+
llist_for_each_entry_safe(conn, conn_temp, &network->subscr_conns, entry) {
/* Clear only A connections and connections that actually
* belong to the specified BSC */
diff --git a/src/libmsc/a_iface_bssap.c b/src/libmsc/a_iface_bssap.c
index 3ff82651..95b8fcdd 100644
--- a/src/libmsc/a_iface_bssap.c
+++ b/src/libmsc/a_iface_bssap.c
@@ -77,6 +77,8 @@ struct gsm_subscriber_connection *subscr_conn_lookup_a(struct gsm_network *netwo
{
struct gsm_subscriber_connection *conn;
+ OSMO_ASSERT(network);
+
DEBUGP(DMSC, "Looking for A subscriber: conn_id %i\n", conn_id);
/* FIXME: log_subscribers() is defined in iucs.c as static inline, if
@@ -163,6 +165,10 @@ void sccp_rx_udt(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, st
* via UNITDATA are BSS Management messages */
struct bssmap_header *bs;
+ OSMO_ASSERT(scu);
+ OSMO_ASSERT(a_conn_info);
+ OSMO_ASSERT(msg);
+
LOGP(DMSC, LOGL_NOTICE, "Rx BSC UDT: %s\n", osmo_hexdump(msgb_l2(msg), msgb_l2len(msg)));
if (msgb_l2len(msg) < sizeof(*bs)) {
@@ -669,6 +675,10 @@ static int rx_dtap(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info,
/* Handle incoming connection oriented messages */
int sccp_rx_dt(struct osmo_sccp_user *scu, struct a_conn_info *a_conn_info, struct msgb *msg)
{
+ OSMO_ASSERT(scu);
+ OSMO_ASSERT(a_conn_info);
+ OSMO_ASSERT(msg);
+
if (msgb_l2len(msg) < sizeof(struct bssmap_header)) {
LOGP(DMSC, LOGL_NOTICE, "The header is too short -- discarding message!\n");
msgb_free(msg);