aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-11 11:35:58 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-11 13:13:55 +0200
commit09fdf6622a3774849bc90b9c4fedf76fdc76ac03 (patch)
tree446baf2a4ac71caaf5d74d77b52acf56a5616c99
parent37e896dff112fda77c29de770a0d8b3fe8800a5a (diff)
bssgp: Handle btcx == NULL in gprs_bssgp_pcu_rx_sign (Coverity)
Currently it is assumed, that btcx is non-NULL. The btcx is only used to obtain the BVCI in some log messages. This commit changes that by using -1 as shown BVCI value. Fixes: Coverity CID 1040961 Sponsored-by: On-Waves ehf
-rw-r--r--src/gprs_bssgp_pcu.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index 1c35667..9bdae39 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -259,10 +259,11 @@ static int gprs_bssgp_pcu_rx_sign(struct msgb *msg, struct tlv_parsed *tp, struc
{
struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) msgb_bssgph(msg);
int rc = 0;
+ int bvci = bctx ? bctx->bvci : -1;
switch (bgph->pdu_type) {
case BSSGP_PDUT_STATUS:
/* Some exception has occurred */
- DEBUGP(DBSSGP, "BSSGP BVCI=%u Rx BVC STATUS\n", bctx->bvci);
+ DEBUGP(DBSSGP, "BSSGP BVCI=%d Rx BVC STATUS\n", bvci);
/* FIXME: send NM_STATUS.ind to NM */
break;
case BSSGP_PDUT_SUSPEND_ACK:
@@ -309,7 +310,8 @@ static int gprs_bssgp_pcu_rx_sign(struct msgb *msg, struct tlv_parsed *tp, struc
LOGP(DBSSGP, LOGL_DEBUG, "rx BSSGP_PDUT_SGSN_INVOKE_TRACE\n");
break;
default:
- LOGP(DBSSGP, LOGL_NOTICE, "BSSGP BVCI=%u Rx PDU type 0x%02x unknown\n", bctx->bvci, bgph->pdu_type);
+ LOGP(DBSSGP, LOGL_NOTICE, "BSSGP BVCI=%d Rx PDU type 0x%02x unknown\n",
+ bvci, bgph->pdu_type);
rc = bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, msg);
break;
}