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
This commit is contained in:
Pau Espin Pedrol 2020-12-09 17:29:12 +01:00 committed by laforge
parent ef65d3ddb4
commit 7c5b7ad633
1 changed files with 1 additions and 0 deletions

View File

@ -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;
}