Change in libosmocore[master]: bts_features: fix: properly check the result of bitvec_get_bit_pos()
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/18619 ) Change subject: bts_features: fix: properly check the result of bitvec_get_bit_pos() .. Patch Set 2: Code-Review+1 (1 comment) https://gerrit.osmocom.org/c/libosmocore/+/18619/2/include/osmocom/gsm/bts_features.h File include/osmocom/gsm/bts_features.h: https://gerrit.osmocom.org/c/libosmocore/+/18619/2/include/osmocom/gsm/bts_features.h@43 PS2, Line 43: return bitvec_get_bit_pos(features, feature) == ONE; > We could print a warning instead ;) ah ok, I was considering the "feature" param is sanitized before calling this function, like checking feature < _NUM_BTS_FEAT. -- 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 Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Comment-Date: Tue, 02 Jun 2020 10:44:27 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: Vadim Yanitskiy Comment-In-Reply-To: pespin Gerrit-MessageType: comment
Change in libosmocore[master]: bts_features: fix: properly check the result of bitvec_get_bit_pos()
Vadim Yanitskiy has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/18619 ) Change subject: bts_features: fix: properly check the result of bitvec_get_bit_pos() .. Patch Set 2: (1 comment) https://gerrit.osmocom.org/c/libosmocore/+/18619/2/include/osmocom/gsm/bts_features.h File include/osmocom/gsm/bts_features.h: https://gerrit.osmocom.org/c/libosmocore/+/18619/2/include/osmocom/gsm/bts_features.h@43 PS2, Line 43: return bitvec_get_bit_pos(features, feature) == ONE; > I don't think so. […] We could print a warning instead ;) -- 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 Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: laforge Gerrit-CC: pespin Gerrit-Comment-Date: Tue, 02 Jun 2020 10:18:23 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: Vadim Yanitskiy Comment-In-Reply-To: pespin Gerrit-MessageType: comment
Change in libosmocore[master]: bts_features: fix: properly check the result of bitvec_get_bit_pos()
Vadim Yanitskiy has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/18619 ) Change subject: bts_features: fix: properly check the result of bitvec_get_bit_pos() .. Patch Set 2: (1 comment) https://gerrit.osmocom.org/c/libosmocore/+/18619/2/include/osmocom/gsm/bts_features.h File include/osmocom/gsm/bts_features.h: https://gerrit.osmocom.org/c/libosmocore/+/18619/2/include/osmocom/gsm/bts_features.h@43 PS2, Line 43: return bitvec_get_bit_pos(features, feature) == ONE; > shouldn't we better assert() in this case? I don't think so. Imagine you're running an old version of osmo-bsc and the recent version of osmo-bts that has some new features (and thus sends a longer feature vector). We don't want to crash the whole BSC just because of that, right? -- 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 Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Reviewer: laforge Gerrit-CC: pespin Gerrit-Comment-Date: Tue, 02 Jun 2020 10:17:32 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin Gerrit-MessageType: comment
Change in libosmocore[master]: bts_features: fix: properly check the result of bitvec_get_bit_pos()
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/18619 ) Change subject: bts_features: fix: properly check the result of bitvec_get_bit_pos() .. Patch Set 2: (1 comment) https://gerrit.osmocom.org/c/libosmocore/+/18619/2/include/osmocom/gsm/bts_features.h File include/osmocom/gsm/bts_features.h: https://gerrit.osmocom.org/c/libosmocore/+/18619/2/include/osmocom/gsm/bts_features.h@43 PS2, Line 43: return bitvec_get_bit_pos(features, feature) == ONE; shouldn't we better assert() in this case? -- 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 Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-CC: pespin Gerrit-Comment-Date: Tue, 02 Jun 2020 10:12:41 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
Change in libosmocore[master]: bts_features: fix: properly check the result of bitvec_get_bit_pos()
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/18619 ) Change subject: bts_features: fix: properly check the result of bitvec_get_bit_pos() .. Patch Set 1: Code-Review+2 -- 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: 1 Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Comment-Date: Sun, 31 May 2020 18:39:52 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in libosmocore[master]: bts_features: fix: properly check the result of bitvec_get_bit_pos()
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 Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-MessageType: merged
Change in libosmocore[master]: bts_features: fix: properly check the result of bitvec_get_bit_pos()
Vadim Yanitskiy has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/19/18619/1 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: 1 Gerrit-Owner: Vadim Yanitskiy Gerrit-MessageType: newchange