diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-10-09 04:59:42 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:54:48 -0400 |
commit | cfcabdcc2d5a810208e5bb3974121b7ed60119aa (patch) | |
tree | 1aed711eeecc5a303b57f1fc47e1b5746e8a72c2 /net/ipv4 | |
parent | de83c058af25aa97ed4864abab11e90e8dead6e2 (diff) |
[NET]: sparse warning fixes
Fix a bunch of sparse warnings. Mostly about 0 used as
NULL pointer, and shadowed variable declarations.
One notable case was that hash size should have been unsigned.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/igmp.c | 5 | ||||
-rw-r--r-- | net/ipv4/inet_lro.c | 2 | ||||
-rw-r--r-- | net/ipv4/ip_sockglue.c | 6 | ||||
-rw-r--r-- | net/ipv4/proc.c | 2 | ||||
-rw-r--r-- | net/ipv4/route.c | 4 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 2 |
6 files changed, 10 insertions, 11 deletions
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index ad500a43b359..2b6e59c4c0d0 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -1695,8 +1695,8 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, | |||
1695 | (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[i]); | 1695 | (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[i]); |
1696 | } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) { | 1696 | } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) { |
1697 | #ifdef CONFIG_IP_MULTICAST | 1697 | #ifdef CONFIG_IP_MULTICAST |
1698 | struct in_device *in_dev = pmc->interface; | ||
1699 | struct ip_sf_list *psf; | 1698 | struct ip_sf_list *psf; |
1699 | in_dev = pmc->interface; | ||
1700 | #endif | 1700 | #endif |
1701 | 1701 | ||
1702 | /* filter mode change */ | 1702 | /* filter mode change */ |
@@ -1799,7 +1799,7 @@ static int ip_mc_leave_src(struct sock *sk, struct ip_mc_socklist *iml, | |||
1799 | { | 1799 | { |
1800 | int err; | 1800 | int err; |
1801 | 1801 | ||
1802 | if (iml->sflist == 0) { | 1802 | if (iml->sflist == NULL) { |
1803 | /* any-source empty exclude case */ | 1803 | /* any-source empty exclude case */ |
1804 | return ip_mc_del_src(in_dev, &iml->multi.imr_multiaddr.s_addr, | 1804 | return ip_mc_del_src(in_dev, &iml->multi.imr_multiaddr.s_addr, |
1805 | iml->sfmode, 0, NULL, 0); | 1805 | iml->sfmode, 0, NULL, 0); |
@@ -2167,7 +2167,6 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, | |||
2167 | return -EFAULT; | 2167 | return -EFAULT; |
2168 | } | 2168 | } |
2169 | for (i=0; i<copycount; i++) { | 2169 | for (i=0; i<copycount; i++) { |
2170 | struct sockaddr_in *psin; | ||
2171 | struct sockaddr_storage ss; | 2170 | struct sockaddr_storage ss; |
2172 | 2171 | ||
2173 | psin = (struct sockaddr_in *)&ss; | 2172 | psin = (struct sockaddr_in *)&ss; |
diff --git a/net/ipv4/inet_lro.c b/net/ipv4/inet_lro.c index 20bc593bb963..4545b64e2815 100644 --- a/net/ipv4/inet_lro.c +++ b/net/ipv4/inet_lro.c | |||
@@ -482,7 +482,7 @@ static struct sk_buff *__lro_proc_segment(struct net_lro_mgr *lro_mgr, | |||
482 | 482 | ||
483 | lro_init_desc(lro_desc, skb, iph, tcph, 0, NULL); | 483 | lro_init_desc(lro_desc, skb, iph, tcph, 0, NULL); |
484 | LRO_INC_STATS(lro_mgr, aggregated); | 484 | LRO_INC_STATS(lro_mgr, aggregated); |
485 | return 0; | 485 | return NULL; |
486 | } | 486 | } |
487 | 487 | ||
488 | if (lro_desc->tcp_next_seq != ntohl(tcph->seq)) | 488 | if (lro_desc->tcp_next_seq != ntohl(tcph->seq)) |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index b2b3053dfef7..f51f20e487c8 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -659,7 +659,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
659 | break; | 659 | break; |
660 | } | 660 | } |
661 | msf = kmalloc(optlen, GFP_KERNEL); | 661 | msf = kmalloc(optlen, GFP_KERNEL); |
662 | if (msf == 0) { | 662 | if (!msf) { |
663 | err = -ENOBUFS; | 663 | err = -ENOBUFS; |
664 | break; | 664 | break; |
665 | } | 665 | } |
@@ -816,7 +816,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
816 | break; | 816 | break; |
817 | } | 817 | } |
818 | gsf = kmalloc(optlen,GFP_KERNEL); | 818 | gsf = kmalloc(optlen,GFP_KERNEL); |
819 | if (gsf == 0) { | 819 | if (!gsf) { |
820 | err = -ENOBUFS; | 820 | err = -ENOBUFS; |
821 | break; | 821 | break; |
822 | } | 822 | } |
@@ -836,7 +836,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
836 | } | 836 | } |
837 | msize = IP_MSFILTER_SIZE(gsf->gf_numsrc); | 837 | msize = IP_MSFILTER_SIZE(gsf->gf_numsrc); |
838 | msf = kmalloc(msize,GFP_KERNEL); | 838 | msf = kmalloc(msize,GFP_KERNEL); |
839 | if (msf == 0) { | 839 | if (!msf) { |
840 | err = -ENOBUFS; | 840 | err = -ENOBUFS; |
841 | goto mc_msf_out; | 841 | goto mc_msf_out; |
842 | } | 842 | } |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 9dee70e1cf0d..e5b05b039101 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -144,7 +144,7 @@ static struct { | |||
144 | { "TimestampReps", ICMP_TIMESTAMPREPLY }, | 144 | { "TimestampReps", ICMP_TIMESTAMPREPLY }, |
145 | { "AddrMasks", ICMP_ADDRESS }, | 145 | { "AddrMasks", ICMP_ADDRESS }, |
146 | { "AddrMaskReps", ICMP_ADDRESSREPLY }, | 146 | { "AddrMaskReps", ICMP_ADDRESSREPLY }, |
147 | { 0, 0 } | 147 | { NULL, 0 } |
148 | }; | 148 | }; |
149 | 149 | ||
150 | 150 | ||
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 2a9b363e820c..307e1f1107ca 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -246,7 +246,7 @@ static spinlock_t *rt_hash_locks; | |||
246 | 246 | ||
247 | static struct rt_hash_bucket *rt_hash_table; | 247 | static struct rt_hash_bucket *rt_hash_table; |
248 | static unsigned rt_hash_mask; | 248 | static unsigned rt_hash_mask; |
249 | static int rt_hash_log; | 249 | static unsigned int rt_hash_log; |
250 | static unsigned int rt_hash_rnd; | 250 | static unsigned int rt_hash_rnd; |
251 | 251 | ||
252 | static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); | 252 | static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); |
@@ -593,7 +593,7 @@ static void rt_check_expire(struct work_struct *work) | |||
593 | i = (i + 1) & rt_hash_mask; | 593 | i = (i + 1) & rt_hash_mask; |
594 | rthp = &rt_hash_table[i].chain; | 594 | rthp = &rt_hash_table[i].chain; |
595 | 595 | ||
596 | if (*rthp == 0) | 596 | if (*rthp == NULL) |
597 | continue; | 597 | continue; |
598 | spin_lock_bh(rt_hash_lock_addr(i)); | 598 | spin_lock_bh(rt_hash_lock_addr(i)); |
599 | while ((rth = *rthp) != NULL) { | 599 | while ((rth = *rthp) != NULL) { |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 4268cd13ff9a..e8c39488cf58 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -2704,7 +2704,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p) | |||
2704 | BUG_TRAP((int)tp->lost_out >= 0); | 2704 | BUG_TRAP((int)tp->lost_out >= 0); |
2705 | BUG_TRAP((int)tp->retrans_out >= 0); | 2705 | BUG_TRAP((int)tp->retrans_out >= 0); |
2706 | if (!tp->packets_out && tcp_is_sack(tp)) { | 2706 | if (!tp->packets_out && tcp_is_sack(tp)) { |
2707 | const struct inet_connection_sock *icsk = inet_csk(sk); | 2707 | icsk = inet_csk(sk); |
2708 | if (tp->lost_out) { | 2708 | if (tp->lost_out) { |
2709 | printk(KERN_DEBUG "Leak l=%u %d\n", | 2709 | printk(KERN_DEBUG "Leak l=%u %d\n", |
2710 | tp->lost_out, icsk->icsk_ca_state); | 2710 | tp->lost_out, icsk->icsk_ca_state); |