]> Pileus Git - ~andy/linux/blobdiff - net/netfilter/nf_tables_api.c
netfilter: nf_tables: fix overrun in nf_tables_set_alloc_name()
[~andy/linux] / net / netfilter / nf_tables_api.c
index 9ce30534f8533cd63a023e16bd66565bc43b46cc..2a22a186eb3d2f20188f98e0695dfc6b4cce31aa 100644 (file)
@@ -1989,13 +1989,13 @@ static int nf_tables_set_alloc_name(struct nft_ctx *ctx, struct nft_set *set,
 
                        if (!sscanf(i->name, name, &tmp))
                                continue;
-                       if (tmp < 0 || tmp > BITS_PER_LONG * PAGE_SIZE)
+                       if (tmp < 0 || tmp >= BITS_PER_BYTE * PAGE_SIZE)
                                continue;
 
                        set_bit(tmp, inuse);
                }
 
-               n = find_first_zero_bit(inuse, BITS_PER_LONG * PAGE_SIZE);
+               n = find_first_zero_bit(inuse, BITS_PER_BYTE * PAGE_SIZE);
                free_page((unsigned long)inuse);
        }