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/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/92 subscr_name(): Handle case for subscr == NULL subscr_name() was called from several places: * either without a check for subscr being NULL, which for example was causing a segfault if we hand-over a channel before identifying the subscriber * or with an explicit NULL check and the ternary operator (?). We now simplify the code by checking for the NULL Subscriber in subscr_name() itself. Change-Id: Ide09f4a515222eb2ec6c25e7a6a8c5f6cc2ffd4b --- M openbsc/src/libbsc/abis_rsl.c M openbsc/src/libcommon/gsm_subscriber_base.c M openbsc/src/libmsc/gsm_04_08.c 3 files changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/92/92/1 diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index df76788..868a069 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -1048,7 +1048,7 @@ int i; char *name = ""; - if (lchan && lchan->conn && lchan->conn->subscr) + if (lchan && lchan->conn) name = subscr_name(lchan->conn->subscr); DEBUGP(DMEAS, "[%s] MEASUREMENT RESULT NR=%d ", name, mr->nr); diff --git a/openbsc/src/libcommon/gsm_subscriber_base.c b/openbsc/src/libcommon/gsm_subscriber_base.c index 50f4118..1f98cc6 100644 --- a/openbsc/src/libcommon/gsm_subscriber_base.c +++ b/openbsc/src/libcommon/gsm_subscriber_base.c @@ -43,6 +43,9 @@ char *subscr_name(struct gsm_subscriber *subscr) { + if (!subscr) + return "unknown"; + if (strlen(subscr->name)) return subscr->name; diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index f02f784..8b4ca67 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -447,8 +447,7 @@ msg->lchan = conn->lchan; LOGP(DMM, LOGL_INFO, "Subscriber %s: LOCATION UPDATING REJECT " - "LAC=%u BTS=%u\n", conn->subscr ? - subscr_name(conn->subscr) : "unknown", + "LAC=%u BTS=%u\n", subscr_name(conn->subscr), bts->location_area_code, bts->nr); return gsm48_conn_sendmsg(msg, conn, NULL); @@ -1147,9 +1146,7 @@ break; case GSM48_MT_MM_TMSI_REALL_COMPL: DEBUGP(DMM, "TMSI Reallocation Completed. Subscriber: %s\n", - conn->subscr ? - subscr_name(conn->subscr) : - "unknown subscriber"); + subscr_name(conn->subscr)); release_loc_updating_req(conn, 1); break; case GSM48_MT_MM_IMSI_DETACH_IND: -- To view, visit https://gerrit.osmocom.org/92 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ide09f4a515222eb2ec6c25e7a6a8c5f6cc2ffd4b Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>