Change in libosmocore[master]: iuup: Fix signed/unsigned loop counter control flow issue

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
Fri Dec 24 10:38:29 UTC 2021


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/26684 )


Change subject: iuup: Fix signed/unsigned loop counter control flow issue
......................................................................

iuup: Fix signed/unsigned loop counter control flow issue

The use of an unsinged integer as for loop counter variable doesn't
work when counting down and comparing with >= 0.  The existing code
would be an infinite loop if it wasn't for the (data dependent) break
condition:

>>>     CID 243259:  Control flow issues  (NO_EFFECT)
>>>     This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "i >= 0U".
572             for (i = 15; i >= 0; i--) {
573                     if (match_mask & (1<<i)) {
574                             iui->mode_version = i;
575                             break;
576                     }

Change-Id: I019d0f0d8f2b167575a2883a13cca692c96961cf
Closes: CID#243259
---
M src/gsm/iuup.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/84/26684/1

diff --git a/src/gsm/iuup.c b/src/gsm/iuup.c
index 159e533..b838dc6 100644
--- a/src/gsm/iuup.c
+++ b/src/gsm/iuup.c
@@ -493,7 +493,7 @@
 	struct iuup_ctrl_init_tail *itail;
 	enum iuup_error_cause err_cause;
 	uint8_t num_rfci = 0;
-	unsigned int i;
+	int i;
 	bool is_last;
 	uint16_t remote_mask, match_mask;
 	struct osmo_iuup_tnl_prim *resp;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I019d0f0d8f2b167575a2883a13cca692c96961cf
Gerrit-Change-Number: 26684
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211224/1cdc6e10/attachment.htm>


More information about the gerrit-log mailing list