[PATCH] ipa: Be consistent in checking conn->cfg (Coverity)

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Thu Apr 3 10:10:24 UTC 2014


Coverity complains about checking connection->cfg in
bsc_close_connection() at one place but not at the second.

This patch fixes this by adding a check before accessing cfg when
generating the 'partial message' log message.

Fixes: Coverity CID 1195180
Sponsored-by: On-Waves ehf
---
 openbsc/src/osmo-bsc_nat/bsc_nat.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index 524186a..9defbd2 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -916,7 +916,7 @@ void bsc_close_connection(struct bsc_connection *connection)
 
 	if (connection->pending_msg) {
 		LOGP(DNAT, LOGL_ERROR, "Dropping partial message on connection %d.\n",
-		     connection->cfg->nr);
+		     connection->cfg ? connection->cfg->nr : -1);
 		msgb_free(connection->pending_msg);
 		connection->pending_msg = NULL;
 	}
-- 
1.7.9.5





More information about the OpenBSC mailing list