public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Pablo Neira Ayuso <pablo@netfilter.org>,
	Patrick McHardy <kaber@trash.net>,
	Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
	"David S. Miller" <davem@davemloft.net>,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Daniel Borkmann <daniel@iogearbox.net>
Subject: unused code in net/netfilter/ipset/ip_set_bitmap_ipmac.c
Date: Mon, 29 Feb 2016 12:14:39 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.10.1602291202590.2600@hadrien> (raw)

The file net/netfilter/ipset/ip_set_bitmap_ipmac.c seems to contain a lot
of static functions that are not used in the file:

bitmap_ipmac_add_timeout
bitmap_ipmac_do_add
bitmap_ipmac_do_del
bitmap_ipmac_do_head
bitmap_ipmac_do_list
bitmap_ipmac_do_test
bitmap_ipmac_gc_test
bitmap_ipmac_is_filled
bitmap_ipmac_kadt
bitmap_ipmac_same_set
bitmap_ipmac_uadt

Have I overooked something?

I was looking at this code, with Daniel Borkmann, because there seems to
be a bug in the function bitmap_ipmac_uadt:

	if (tb[IPSET_ATTR_ETHER]) {
                memcpy(e.ether, nla_data(tb[IPSET_ATTR_ETHER]), ETH_ALEN);
                e.add_mac = 1;
        }

Later in the same file, there is:

static struct ip_set_type bitmap_ipmac_type = {
	...
        .adt_policy     = {
		...
		[IPSET_ATTR_ETHER]      = { .type = NLA_BINARY,
                                            .len  = ETH_ALEN },
		...},
	...
};

The type NLA_BINARY indicates that the length is a maximum possible
length, and thus a check of the actual length is needed before the memcpy.

The file net/netfilter/ipset/ip_set_hash_mac.c seems to have a similar
problem.  The following static functions are not used:

hash_mac4_data_equal
hash_mac4_data_list
hash_mac4_data_next
hash_mac4_kadt
hash_mac4_uadt

And the following code:

ether_addr_copy(e.ether, nla_data(tb[IPSET_ATTR_ETHER]));

in hash_mac4_uadt does not seem to have a check on the length, and the
field is defined in the same way as above.

julia

             reply	other threads:[~2016-02-29 11:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 11:14 Julia Lawall [this message]
2016-02-29 11:23 ` unused code in net/netfilter/ipset/ip_set_bitmap_ipmac.c Jozsef Kadlecsik
2016-02-29 12:27   ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.10.1602291202590.2600@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=coreteam@netfilter.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=kaber@trash.net \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox