From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754607AbcB2LOt (ORCPT ); Mon, 29 Feb 2016 06:14:49 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:9849 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754527AbcB2LOq (ORCPT ); Mon, 29 Feb 2016 06:14:46 -0500 X-IronPort-AV: E=Sophos;i="5.22,520,1449529200"; d="scan'208";a="166319491" Date: Mon, 29 Feb 2016 12:14:39 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Pablo Neira Ayuso , Patrick McHardy , Jozsef Kadlecsik , "David S. Miller" , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org cc: Daniel Borkmann Subject: unused code in net/netfilter/ipset/ip_set_bitmap_ipmac.c Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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