diff options
author | Oliver Smith <osmith@sysmocom.de> | 2019-10-18 09:59:43 +0200 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2019-10-21 11:09:08 +0200 |
commit | e4abc63e429110aecc0991c78424745f5109fae8 (patch) | |
tree | 5d9bfa47f5ee00d2eb399b78f0b33d76f5a85170 | |
parent | 583f2b86c9383dd6222bcabf05d312b53e02e3db (diff) |
vty.c: avoid coverity BAD_SHIFT issues
Make it obvious for compilers and for coverity, that the sapi value used
to shift a bit for the sapi_mask is always <= 31. The sapi value is an
index of the value string l1sap_common_sapi_names, which has 24 entries.
Fixes: CID#205067, CID#205068
Change-Id: Id8be0ab67479b1f76a4f624bd3a5242e4fe59f4b
-rw-r--r-- | src/common/vty.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/vty.c b/src/common/vty.c index 2e7a66d0..e775d999 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -1616,6 +1616,7 @@ DEFUN(logging_fltr_l1_sapi, logging_fltr_l1_sapi_cmd, "HIDDEN", "HIDDEN") if (!*sapi_mask) *sapi_mask = talloc(tgt, uint16_t); + OSMO_ASSERT(sapi <= 31); **sapi_mask |= (1 << sapi); tgt->filter_map |= (1 << LOG_FLT_L1_SAPI); @@ -1634,6 +1635,7 @@ DEFUN(no_logging_fltr_l1_sapi, no_logging_fltr_l1_sapi_cmd, "HIDDEN", "HIDDEN") if (!tgt->filter_data[LOG_FLT_L1_SAPI]) return CMD_SUCCESS; + OSMO_ASSERT(sapi <= 31); sapi_mask = (uint16_t *)tgt->filter_data[LOG_FLT_L1_SAPI]; *sapi_mask &= ~(1 << sapi); |