[PATCH] osmo-bts[master]: SACCH SI: assert that SI enum vals fit in bit mask

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Feb 8 18:34:31 UTC 2017


Review at  https://gerrit.osmocom.org/1781

SACCH SI: assert that SI enum vals fit in bit mask

In case our SI enums ever move past 31, this static assert will warn us to
enlarge osmo_si_shifted.

Change-Id: I4185d7de590329ff5f523b241721c586ffdbcd8b
---
M src/common/rsl.c
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/81/1781/1

diff --git a/src/common/rsl.c b/src/common/rsl.c
index c657b0f..2f6c0c6 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -689,6 +689,9 @@
 		uint8_t rsl_si = rsl_sacch_sitypes[i];
 		int osmo_si = osmo_rsl2sitype(rsl_si);
 		uint32_t osmo_si_shifted = (1 << osmo_si);
+		osmo_static_assert(_MAX_SYSINFO_TYPE <= sizeof(osmo_si_shifted) * 8,
+				   si_enum_vals_fit_in_bit_mask);
+
 		if (osmo_si == SYSINFO_TYPE_NONE)
 			continue;
 		if (!(bts->si_valid & osmo_si_shifted)) {

-- 
To view, visit https://gerrit.osmocom.org/1781
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4185d7de590329ff5f523b241721c586ffdbcd8b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list