aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-05-31 16:06:36 +0700
committerlaforge <laforge@osmocom.org>2020-05-31 18:40:20 +0000
commitf8e153d815ead9bd11665d0270c439ab5c5f568b (patch)
tree3e2e46778a2598c80567b062575c0500009303e0
parentb795f03faff894d62b02dc03dd37e4136f055db1 (diff)
bts_features: fix: properly check the result of bitvec_get_bit_pos()
If a feature index does not fit to the feature vector, this function would return a negative number that would be casted to true. This is wrong, we should return false instead. Change-Id: Id1ad92e7654a806bb920ae9507c88a122e8d09f0
-rw-r--r--include/osmocom/gsm/bts_features.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/osmocom/gsm/bts_features.h b/include/osmocom/gsm/bts_features.h
index 7ead0203..6ab8f622 100644
--- a/include/osmocom/gsm/bts_features.h
+++ b/include/osmocom/gsm/bts_features.h
@@ -40,5 +40,5 @@ static inline int osmo_bts_set_feature(struct bitvec *features, enum osmo_bts_fe
static inline bool osmo_bts_has_feature(const struct bitvec *features, enum osmo_bts_features feature)
{
OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES);
- return bitvec_get_bit_pos(features, feature);
+ return bitvec_get_bit_pos(features, feature) == ONE;
}