[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1JBqpd-0006vB-00@gondolin.me.apana.org.au>
Date: Mon, 07 Jan 2008 23:11:53 +1100
From: Herbert Xu <herbert@...dor.apana.org.au>
To: dada1@...mosbay.com (Eric Dumazet)
Cc: davem@...emloft.net, netdev@...r.kernel.org,
viro@...IV.linux.org.uk
Subject: Re: [IPV4] ROUTE: Avoid sparse warnings
Eric Dumazet <dada1@...mosbay.com> wrote:
> CHECK net/ipv4/route.c
> net/ipv4/route.c:298:2: warning: context imbalance in 'rt_cache_get_first' - wrong count at exit
> net/ipv4/route.c:307:3: warning: context imbalance in 'rt_cache_get_next' - unexpected unlock
> net/ipv4/route.c:346:3: warning: context imbalance in 'rt_cache_seq_stop' - unexpected unlock
>
> Signed-off-by: Eric Dumazet <dada1@...mosbay.com>
>
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 10915bb..fec0571 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -289,11 +289,11 @@ static struct rtable *rt_cache_get_first(struct seq_file *seq)
> struct rt_cache_iter_state *st = seq->private;
>
> for (st->bucket = rt_hash_mask; st->bucket >= 0; --st->bucket) {
> - rcu_read_lock_bh();
> r = rt_hash_table[st->bucket].chain;
> if (r)
> break;
> rcu_read_unlock_bh();
> + rcu_read_lock_bh();
If we have to change perfectly working code to silence sparse then
either sparse or we are doing something wrong.
This is not the only spot where we conditionally hold the lock.
There's got to be a better fix than changing all of them to hold
locks unconditionally.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists