Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: fix various sparse warnings

net/bridge/br_netfilter.c:870:6: symbol 'br_netfilter_enable' was not declared. Should it be static?
no; add include
net/ipv4/netfilter/nft_reject_ipv4.c:22:6: symbol 'nft_reject_ipv4_eval' was not declared. Should it be static?
yes
net/ipv6/netfilter/nf_reject_ipv6.c:16:6: symbol 'nf_send_reset6' was not declared. Should it be static?
no; add include
net/ipv6/netfilter/nft_reject_ipv6.c:22:6: symbol 'nft_reject_ipv6_eval' was not declared. Should it be static?
yes
net/netfilter/core.c:33:32: symbol 'nf_ipv6_ops' was not declared. Should it be static?
no; add include
net/netfilter/xt_DSCP.c:40:57: cast truncates bits from constant value (ffffff03 becomes 3)
net/netfilter/xt_DSCP.c:57:59: cast truncates bits from constant value (ffffff03 becomes 3)
add __force, 3 is what we want.
net/ipv4/netfilter/nf_log_arp.c:77:6: symbol 'nf_log_arp_packet' was not declared. Should it be static?
yes
net/ipv4/netfilter/nf_reject_ipv4.c:17:6: symbol 'nf_send_reset' was not declared. Should it be static?
no; add include

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Florian Westphal and committed by
Pablo Neira Ayuso
56768644 baf4750d

+20 -16
+1
net/bridge/br_netfilter.c
··· 35 35 #include <net/ip.h> 36 36 #include <net/ipv6.h> 37 37 #include <net/route.h> 38 + #include <net/netfilter/br_netfilter.h> 38 39 39 40 #include <asm/uaccess.h> 40 41 #include "br_private.h"
+6 -6
net/ipv4/netfilter/nf_log_arp.c
··· 75 75 ap->mac_src, ap->ip_src, ap->mac_dst, ap->ip_dst); 76 76 } 77 77 78 - void nf_log_arp_packet(struct net *net, u_int8_t pf, 79 - unsigned int hooknum, const struct sk_buff *skb, 80 - const struct net_device *in, 81 - const struct net_device *out, 82 - const struct nf_loginfo *loginfo, 83 - const char *prefix) 78 + static void nf_log_arp_packet(struct net *net, u_int8_t pf, 79 + unsigned int hooknum, const struct sk_buff *skb, 80 + const struct net_device *in, 81 + const struct net_device *out, 82 + const struct nf_loginfo *loginfo, 83 + const char *prefix) 84 84 { 85 85 struct nf_log_buf *m; 86 86
+1
net/ipv4/netfilter/nf_reject_ipv4.c
··· 11 11 #include <net/tcp.h> 12 12 #include <net/route.h> 13 13 #include <net/dst.h> 14 + #include <net/netfilter/ipv4/nf_reject.h> 14 15 #include <linux/netfilter_ipv4.h> 15 16 16 17 /* Send RST reply */
+3 -4
net/ipv4/netfilter/nft_reject_ipv4.c
··· 19 19 #include <net/netfilter/ipv4/nf_reject.h> 20 20 #include <net/netfilter/nft_reject.h> 21 21 22 - void nft_reject_ipv4_eval(const struct nft_expr *expr, 23 - struct nft_data data[NFT_REG_MAX + 1], 24 - const struct nft_pktinfo *pkt) 22 + static void nft_reject_ipv4_eval(const struct nft_expr *expr, 23 + struct nft_data data[NFT_REG_MAX + 1], 24 + const struct nft_pktinfo *pkt) 25 25 { 26 26 struct nft_reject *priv = nft_expr_priv(expr); 27 27 ··· 36 36 37 37 data[NFT_REG_VERDICT].verdict = NF_DROP; 38 38 } 39 - EXPORT_SYMBOL_GPL(nft_reject_ipv4_eval); 40 39 41 40 static struct nft_expr_type nft_reject_ipv4_type; 42 41 static const struct nft_expr_ops nft_reject_ipv4_ops = {
+1
net/ipv6/netfilter/nf_reject_ipv6.c
··· 11 11 #include <net/ip6_route.h> 12 12 #include <net/ip6_fib.h> 13 13 #include <net/ip6_checksum.h> 14 + #include <net/netfilter/ipv6/nf_reject.h> 14 15 #include <linux/netfilter_ipv6.h> 15 16 16 17 void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook)
+3 -4
net/ipv6/netfilter/nft_reject_ipv6.c
··· 19 19 #include <net/netfilter/nft_reject.h> 20 20 #include <net/netfilter/ipv6/nf_reject.h> 21 21 22 - void nft_reject_ipv6_eval(const struct nft_expr *expr, 23 - struct nft_data data[NFT_REG_MAX + 1], 24 - const struct nft_pktinfo *pkt) 22 + static void nft_reject_ipv6_eval(const struct nft_expr *expr, 23 + struct nft_data data[NFT_REG_MAX + 1], 24 + const struct nft_pktinfo *pkt) 25 25 { 26 26 struct nft_reject *priv = nft_expr_priv(expr); 27 27 struct net *net = dev_net((pkt->in != NULL) ? pkt->in : pkt->out); ··· 38 38 39 39 data[NFT_REG_VERDICT].verdict = NF_DROP; 40 40 } 41 - EXPORT_SYMBOL_GPL(nft_reject_ipv6_eval); 42 41 43 42 static struct nft_expr_type nft_reject_ipv6_type; 44 43 static const struct nft_expr_ops nft_reject_ipv6_ops = {
+1
net/netfilter/core.c
··· 17 17 #include <linux/interrupt.h> 18 18 #include <linux/if.h> 19 19 #include <linux/netdevice.h> 20 + #include <linux/netfilter_ipv6.h> 20 21 #include <linux/inetdevice.h> 21 22 #include <linux/proc_fs.h> 22 23 #include <linux/mutex.h>
+4 -2
net/netfilter/xt_DSCP.c
··· 37 37 if (!skb_make_writable(skb, sizeof(struct iphdr))) 38 38 return NF_DROP; 39 39 40 - ipv4_change_dsfield(ip_hdr(skb), (__u8)(~XT_DSCP_MASK), 40 + ipv4_change_dsfield(ip_hdr(skb), 41 + (__force __u8)(~XT_DSCP_MASK), 41 42 dinfo->dscp << XT_DSCP_SHIFT); 42 43 43 44 } ··· 55 54 if (!skb_make_writable(skb, sizeof(struct ipv6hdr))) 56 55 return NF_DROP; 57 56 58 - ipv6_change_dsfield(ipv6_hdr(skb), (__u8)(~XT_DSCP_MASK), 57 + ipv6_change_dsfield(ipv6_hdr(skb), 58 + (__force __u8)(~XT_DSCP_MASK), 59 59 dinfo->dscp << XT_DSCP_SHIFT); 60 60 } 61 61 return XT_CONTINUE;