svn commit: r269877 - projects/ipfw/sys/netpfil/ipfw
Alexander V. Chernikov
melifaro at FreeBSD.org
Tue Aug 12 14:19:46 UTC 2014
Author: melifaro
Date: Tue Aug 12 14:19:45 2014
New Revision: 269877
URL: http://svnweb.freebsd.org/changeset/base/269877
Log:
Do not use index 0 for tables.
Modified:
projects/ipfw/sys/netpfil/ipfw/ip_fw_sockopt.c
Modified: projects/ipfw/sys/netpfil/ipfw/ip_fw_sockopt.c
==============================================================================
--- projects/ipfw/sys/netpfil/ipfw/ip_fw_sockopt.c Tue Aug 12 14:09:15 2014 (r269876)
+++ projects/ipfw/sys/netpfil/ipfw/ip_fw_sockopt.c Tue Aug 12 14:19:45 2014 (r269877)
@@ -2917,7 +2917,7 @@ ipfw_objhash_bitmap_alloc(uint32_t items
{
size_t size;
int max_blocks;
- void *idx_mask;
+ u_long *idx_mask;
items = roundup2(items, BLOCK_ITEMS); /* Align to block size */
max_blocks = items / BLOCK_ITEMS;
@@ -2925,6 +2925,7 @@ ipfw_objhash_bitmap_alloc(uint32_t items
idx_mask = malloc(size * IPFW_MAX_SETS, M_IPFW, M_WAITOK);
/* Mark all as free */
memset(idx_mask, 0xFF, size * IPFW_MAX_SETS);
+ *idx_mask &= ~(u_long)1; /* Skip index 0 */
*idx = idx_mask;
*pblocks = max_blocks;
More information about the svn-src-projects
mailing list