Change in libosmocore[master]: bts_features: fix: properly check the result of bitvec_get_bit_pos()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sun May 31 18:40:20 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/18619 )

Change subject: bts_features: fix: properly check the result of bitvec_get_bit_pos()
......................................................................

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
---
M include/osmocom/gsm/bts_features.h
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/gsm/bts_features.h b/include/osmocom/gsm/bts_features.h
index 7ead020..6ab8f62 100644
--- a/include/osmocom/gsm/bts_features.h
+++ b/include/osmocom/gsm/bts_features.h
@@ -40,5 +40,5 @@
 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;
 }

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/18619
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id1ad92e7654a806bb920ae9507c88a122e8d09f0
Gerrit-Change-Number: 18619
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200531/ee4c9d64/attachment.htm>


More information about the gerrit-log mailing list