From patchwork Thu Apr 21 16:55:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max X-Patchwork-Id: 613198 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 3qrPyR3V2gz9rxl for ; Fri, 22 Apr 2016 02:55:43 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 0F38B13546; Thu, 21 Apr 2016 16:55:42 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from mail.sysmocom.de (mail.sysmocom.de [IPv6:2a01:4f8:191:444c::2:4]) by lists.osmocom.org (Postfix) with ESMTP id 345DE1353D for ; Thu, 21 Apr 2016 16:55:41 +0000 (UTC) Received: from mail.sysmocom.de (mail.sysmocom.de [144.76.43.93]) by mail.sysmocom.de (Postfix) with ESMTP id A68731B25CA; Thu, 21 Apr 2016 16:55:10 +0000 (UTC) Received: from pbell.local (shnet2-91.in-berlin.de [217.197.83.91]) by mail.sysmocom.de (Postfix) with ESMTPSA id 66E7E1B25C9; Thu, 21 Apr 2016 16:55:10 +0000 (UTC) From: msuraev@sysmocom.de To: openbsc@lists.osmocom.org Subject: [PATCH] Ensure TRX invariant Date: Thu, 21 Apr 2016 18:55:09 +0200 Message-Id: <1461257709-25977-1-git-send-email-msuraev@sysmocom.de> X-Mailer: git-send-email 2.8.1 X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" From: Max There is implicit invariant in trx_phy_instance() which is actively used by various hw-specific implementations to get TRX's phy instance. Let's make sure there's explicit assertion for this because there's been segfaults in the past related to it. --- include/osmo-bts/phy_link.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h index a559aa3..edc6cc0 100644 --- a/include/osmo-bts/phy_link.h +++ b/include/osmo-bts/phy_link.h @@ -125,6 +125,7 @@ void phy_user_statechg_notif(struct phy_instance *pinst, enum phy_link_state lin static inline struct phy_instance *trx_phy_instance(struct gsm_bts_trx *trx) { + OSMO_ASSERT(trx); return trx->role_bts.l1h; }