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
This commit is contained in:
parent
1af543f44c
commit
fc6676c4a0
|
@ -240,7 +240,7 @@ int ippool_new(struct ippool_t **this, const struct in46_prefix *dyn, const stru
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue