[MERGED] osmo-ggsn[master]: ippool: Correctly compute size of static pool

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Nov 5 19:08:10 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: ippool: Correctly compute size of static pool
......................................................................


ippool: Correctly compute size of static pool

* we have to use stataddr, not addr (dynamic)
* we have to multiply the length of the address by 8 to get its bit length
* we can simplify the -1 +1 logic (like dynamic)

Change-Id: I174102051bef95f7df34b7d7c480a00ae408be7d
Fixes: Coverity CID#174189
---
M lib/ippool.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/lib/ippool.c b/lib/ippool.c
index 55a41d0..a9a64be 100644
--- a/lib/ippool.c
+++ b/lib/ippool.c
@@ -240,7 +240,7 @@
 		stataddr = stat->addr;
 		stataddrprefixlen = stat->prefixlen;
 
-		statsize = (1 << (addr.len - stataddrprefixlen + 1)) -1;
+		statsize = (1 << (stataddr.len*8 - stataddrprefixlen));
 		if (statsize > IPPOOL_STATSIZE)
 			statsize = IPPOOL_STATSIZE;
 	}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I174102051bef95f7df34b7d7c480a00ae408be7d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list