path: root/include
diff options
authorPau Espin Pedrol <pespin@espeweb.net>2020-12-09 17:29:12 +0100
committerlaforge <laforge@osmocom.org>2020-12-10 15:28:05 +0000
commit7c5b7ad633fde38a60b6d7030f381f3b02b97034 (patch)
tree4d64303afa2e3859fa0b07e70a59252c67c1822e /include
parentef65d3ddb4639661cad89295ee6587930ba9f0ce (diff)
gsm_lchan_name: assert on NULL lchan
Steve Langasek <steve.langasek@ubuntu.com> submitted some patches against downstream osmo-bsc 1.3.0 because some possible null derefences were detected by the compiler on Ubuntu s390x. Code has eveolved since then and patch doesn't apply directly anymore, since related code changed (we now use osmo_count in bsc_subscr_get). The compiled allegedly claimed some null dereference in gsm_lchan_name. In general code using that function seems to be doing checks for existing lchan before calling it, or assuming the lchan pointer is not null, so I couldn't find any major issue. However, let's add a OSMO_ASSERT to make sure we can easily identify the issue if an issue ever happens there, since the gsm_lchan_name should clearly only be called on non null pointers. Change-Id: If4d12cb1d95ee2a89244bb8f27df839871667387
Diffstat (limited to 'include')
1 files changed, 1 insertions, 0 deletions
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 6904266ec..584c0e648 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -937,6 +937,7 @@ char *gsm_lchan_name_compute(const struct gsm_lchan *lchan);
static inline char *gsm_lchan_name(const struct gsm_lchan *lchan)
+ OSMO_ASSERT(lchan);
return lchan->name;