]> granicus.if.org Git - ipset/commitdiff
netfilter: ipset: remove useless memset() calls
authorFlorent Fourcot <florent.fourcot@wifirst.fr>
Tue, 8 Jan 2019 19:37:33 +0000 (20:37 +0100)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Tue, 8 Jan 2019 19:37:33 +0000 (20:37 +0100)
One of the memset call is buggy: it does not erase full array, but only
pointer size.
Moreover, after a check, first step of nla_parse_nested/nla_parse is to
erase tb array as well. We can remove both calls safely.

Signed-off-by: Florent Fourcot <florent.fourcot@wifirst.fr>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
kernel/net/netfilter/ipset/ip_set_core.c

index b424c0410d708c91ceb9d18050744d908903f0b9..c6f81c258c2e086f52d6660b429e90d74491fe54 100644 (file)
@@ -1621,7 +1621,6 @@ IPSET_CBFN(ip_set_uadd, struct net *net, struct sock *ctnl,
                int nla_rem;
 
                nla_for_each_nested(nla, attr[IPSET_ATTR_ADT], nla_rem) {
-                       memset(tb, 0, sizeof(tb));
                        if (nla_type(nla) != IPSET_ATTR_DATA ||
                            !flag_nested(nla) ||
                            NLA_PARSE_NESTED(tb, IPSET_ATTR_ADT_MAX, nla,
@@ -1677,7 +1676,6 @@ IPSET_CBFN(ip_set_udel, struct net *net, struct sock *ctnl,
                int nla_rem;
 
                nla_for_each_nested(nla, attr[IPSET_ATTR_ADT], nla_rem) {
-                       memset(tb, 0, sizeof(*tb));
                        if (nla_type(nla) != IPSET_ATTR_DATA ||
                            !flag_nested(nla) ||
                            NLA_PARSE_NESTED(tb, IPSET_ATTR_ADT_MAX, nla,