Change in osmo-bts[master]: vty.c: avoid coverity BAD_SHIFT issues

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
Mon Oct 21 11:20:53 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/15806 )

Change subject: vty.c: avoid coverity BAD_SHIFT issues
......................................................................

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
---
M src/common/vty.c
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/common/vty.c b/src/common/vty.c
index 2e7a66d..e775d99 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1616,6 +1616,7 @@
 	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 @@
 	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);
 

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id8be0ab67479b1f76a4f624bd3a5242e4fe59f4b
Gerrit-Change-Number: 15806
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191021/f7b52bab/attachment.htm>


More information about the gerrit-log mailing list