[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>
This commit is contained in:

committed by
David S. Miller

parent
de83c058af
commit
cfcabdcc2d
@@ -1695,8 +1695,8 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
|
||||
(void) ip_mc_del1_src(pmc, sfmode, &psfsrc[i]);
|
||||
} else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) {
|
||||
#ifdef CONFIG_IP_MULTICAST
|
||||
struct in_device *in_dev = pmc->interface;
|
||||
struct ip_sf_list *psf;
|
||||
in_dev = pmc->interface;
|
||||
#endif
|
||||
|
||||
/* filter mode change */
|
||||
@@ -1799,7 +1799,7 @@ static int ip_mc_leave_src(struct sock *sk, struct ip_mc_socklist *iml,
|
||||
{
|
||||
int err;
|
||||
|
||||
if (iml->sflist == 0) {
|
||||
if (iml->sflist == NULL) {
|
||||
/* any-source empty exclude case */
|
||||
return ip_mc_del_src(in_dev, &iml->multi.imr_multiaddr.s_addr,
|
||||
iml->sfmode, 0, NULL, 0);
|
||||
@@ -2167,7 +2167,6 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
|
||||
return -EFAULT;
|
||||
}
|
||||
for (i=0; i<copycount; i++) {
|
||||
struct sockaddr_in *psin;
|
||||
struct sockaddr_storage ss;
|
||||
|
||||
psin = (struct sockaddr_in *)&ss;
|
||||
|
@@ -482,7 +482,7 @@ static struct sk_buff *__lro_proc_segment(struct net_lro_mgr *lro_mgr,
|
||||
|
||||
lro_init_desc(lro_desc, skb, iph, tcph, 0, NULL);
|
||||
LRO_INC_STATS(lro_mgr, aggregated);
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (lro_desc->tcp_next_seq != ntohl(tcph->seq))
|
||||
|
@@ -659,7 +659,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
|
||||
break;
|
||||
}
|
||||
msf = kmalloc(optlen, GFP_KERNEL);
|
||||
if (msf == 0) {
|
||||
if (!msf) {
|
||||
err = -ENOBUFS;
|
||||
break;
|
||||
}
|
||||
@@ -816,7 +816,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
|
||||
break;
|
||||
}
|
||||
gsf = kmalloc(optlen,GFP_KERNEL);
|
||||
if (gsf == 0) {
|
||||
if (!gsf) {
|
||||
err = -ENOBUFS;
|
||||
break;
|
||||
}
|
||||
@@ -836,7 +836,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
|
||||
}
|
||||
msize = IP_MSFILTER_SIZE(gsf->gf_numsrc);
|
||||
msf = kmalloc(msize,GFP_KERNEL);
|
||||
if (msf == 0) {
|
||||
if (!msf) {
|
||||
err = -ENOBUFS;
|
||||
goto mc_msf_out;
|
||||
}
|
||||
|
@@ -144,7 +144,7 @@ static struct {
|
||||
{ "TimestampReps", ICMP_TIMESTAMPREPLY },
|
||||
{ "AddrMasks", ICMP_ADDRESS },
|
||||
{ "AddrMaskReps", ICMP_ADDRESSREPLY },
|
||||
{ 0, 0 }
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
|
||||
|
@@ -246,7 +246,7 @@ static spinlock_t *rt_hash_locks;
|
||||
|
||||
static struct rt_hash_bucket *rt_hash_table;
|
||||
static unsigned rt_hash_mask;
|
||||
static int rt_hash_log;
|
||||
static unsigned int rt_hash_log;
|
||||
static unsigned int rt_hash_rnd;
|
||||
|
||||
static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat);
|
||||
@@ -593,7 +593,7 @@ static void rt_check_expire(struct work_struct *work)
|
||||
i = (i + 1) & rt_hash_mask;
|
||||
rthp = &rt_hash_table[i].chain;
|
||||
|
||||
if (*rthp == 0)
|
||||
if (*rthp == NULL)
|
||||
continue;
|
||||
spin_lock_bh(rt_hash_lock_addr(i));
|
||||
while ((rth = *rthp) != NULL) {
|
||||
|
@@ -2704,7 +2704,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p)
|
||||
BUG_TRAP((int)tp->lost_out >= 0);
|
||||
BUG_TRAP((int)tp->retrans_out >= 0);
|
||||
if (!tp->packets_out && tcp_is_sack(tp)) {
|
||||
const struct inet_connection_sock *icsk = inet_csk(sk);
|
||||
icsk = inet_csk(sk);
|
||||
if (tp->lost_out) {
|
||||
printk(KERN_DEBUG "Leak l=%u %d\n",
|
||||
tp->lost_out, icsk->icsk_ca_state);
|
||||
|
Reference in New Issue
Block a user