From 7c5b7ad633fde38a60b6d7030f381f3b02b97034 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 9 Dec 2020 17:29:12 +0100 Subject: [PATCH] gsm_lchan_name: assert on NULL lchan Steve Langasek 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 --- include/osmocom/bsc/gsm_data.h | 1 + 1 file changed, 1 insertion(+) 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; }