diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-11-06 02:58:54 +0900 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-11-06 03:00:08 +0900 |
commit | bb8037b7eb497ea418142a321a268abae6dc271d (patch) | |
tree | 0578d2e68f1aa181968835125e16aae99c03edce /src/osmo-bts-trx/trx_if.c | |
parent | 8e202b595cb1ff6abc1e56f7db599f3307b8e14c (diff) |
trx: Don't assume phy_instance_by_num() returns non-NULL
In trx_clk_read_cb(), when calling phy_instance_by_num(), that
function might in error cases return a NULL phy-instance. Let's
put an OSMO_ASSERT() there as safeguard to avoid NULL dereference
when dereferencing pinst->trx->bts.
Fixes: Coverity CID#178657
Change-Id: If6b6b45380368e9ee9e03ca1eb7ac56c21e72b03
Diffstat (limited to 'src/osmo-bts-trx/trx_if.c')
-rw-r--r-- | src/osmo-bts-trx/trx_if.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c index 1332854d..7030e3c0 100644 --- a/src/osmo-bts-trx/trx_if.c +++ b/src/osmo-bts-trx/trx_if.c @@ -103,6 +103,8 @@ static int trx_clk_read_cb(struct osmo_fd *ofd, unsigned int what) int len; uint32_t fn; + OSMO_ASSERT(pinst); + len = recv(ofd->fd, buf, sizeof(buf) - 1, 0); if (len <= 0) return len; |