[XS] Change in osmo-bts[master]: coverity: ensure lchan->si->* bitmask sizes
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/39376?usp=email ) Change subject: coverity: ensure lchan->si->* bitmask sizes ...................................................................... coverity: ensure lchan->si->* bitmask sizes osmo-bts' gsm_lchan->si bitmasks are 32 bit wide, and loops use _MAX_SYSINFO_TYPE to iterate them. Make sure that _MAX_SYSINFO_TYPE (from libosmocore) never surpasses 32 without us noticing the problem. (However unlikely that is.) Related: CID#465523 Change-Id: Ieb5d35e720e8d77336f6f912d039bab7f3b95c55 --- M include/osmo-bts/lchan.h M tests/misc/misc_test.c 2 files changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/76/39376/1 diff --git a/include/osmo-bts/lchan.h b/include/osmo-bts/lchan.h index 5c34015..25ca477 100644 --- a/include/osmo-bts/lchan.h +++ b/include/osmo-bts/lchan.h @@ -385,6 +385,8 @@ struct osmo_timer_list early_rr_ia_delay; }; +osmo_static_assert(_MAX_SYSINFO_TYPE <= 32, ensure_gsm_lchan_si_bitmasks_are_large_enough); + extern const struct value_string lchan_ciph_state_names[]; static inline const char *lchan_ciph_state_name(uint8_t state) { diff --git a/tests/misc/misc_test.c b/tests/misc/misc_test.c index bbf7557..e9adc5d 100644 --- a/tests/misc/misc_test.c +++ b/tests/misc/misc_test.c @@ -145,7 +145,7 @@ /* initialize the input. */ for (i = 1; i < _MAX_SYSINFO_TYPE; ++i) { - lchan.si.valid |= (1 << i); + lchan.si.valid |= (((uint32_t)1) << i); memset(GSM_LCHAN_SI(&lchan, i), i, GSM_MACBLOCK_LEN); } -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/39376?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ieb5d35e720e8d77336f6f912d039bab7f3b95c55 Gerrit-Change-Number: 39376 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr@sysmocom.de>
participants (1)
-
neels