]> granicus.if.org Git - ipset/commitdiff
Allocate the proper size of memory when /0 networks are supported
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Fri, 3 Oct 2014 05:06:00 +0000 (07:06 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Tue, 18 Nov 2014 06:56:07 +0000 (07:56 +0100)
kernel/net/netfilter/ipset/ip_set_hash_gen.h

index e19105bb92e7abb7fbfb3b5dd3f92a45bfb89d98..6580b7e839d2fe4647f3b100ee1ebe31a2410224 100644 (file)
@@ -1101,8 +1101,7 @@ IPSET_TOKEN(HTYPE, _create)(struct net *net, struct ip_set *set,
 
        hsize = sizeof(*h);
 #ifdef IP_SET_HASH_WITH_NETS
-       hsize += sizeof(struct net_prefixes) *
-               (set->family == NFPROTO_IPV4 ? 32 : 128);
+       hsize += sizeof(struct net_prefixes) * NLEN(set->family);
 #endif
        h = kzalloc(hsize, GFP_KERNEL);
        if (!h)