* [PATCH 0/8] net: fix (sparse) warnings
@ 2009-02-25 20:31 Hannes Eder
2009-02-25 20:31 ` [PATCH 1/8] net/802: fix sparse warnings: context imbalance Hannes Eder
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Hannes Eder @ 2009-02-25 20:31 UTC (permalink / raw)
To: netdev; +Cc: kernel-janitors, linux-kernel
The following series fixes some (sparse) warnings in net/.
---
Hannes Eder (8):
wanrouter: fix sparse warnings: context imbalance
inet fragments: fix sparse warning: context imbalance
decnet: fix sparse warnings: symbol shadows an earlier one
decnet: fix sparse warnings: context imbalance
[NET] sysctl: fix sparse warning: Should it be static?
appletalk: fix warning: format not a string literal and no ...
9p: fix sparse warning: cast adds address space
net/802: fix sparse warnings: context imbalance
include/net/inet_frag.h | 3 ++-
net/802/tr.c | 2 ++
net/9p/trans_fd.c | 2 +-
net/appletalk/ddp.c | 2 +-
net/core/sysctl_net_core.c | 1 +
net/decnet/af_decnet.c | 17 +++++++++--------
net/decnet/dn_dev.c | 3 ++-
net/decnet/sysctl_net_decnet.c | 2 +-
net/ipv4/inet_fragment.c | 1 +
net/wanrouter/wanmain.c | 8 ++++++--
net/wanrouter/wanproc.c | 2 ++
11 files changed, 28 insertions(+), 15 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/8] net/802: fix sparse warnings: context imbalance
2009-02-25 20:31 [PATCH 0/8] net: fix (sparse) warnings Hannes Eder
@ 2009-02-25 20:31 ` Hannes Eder
2009-02-25 20:31 ` [PATCH 2/8] 9p: fix sparse warning: cast adds address space Hannes Eder
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Hannes Eder @ 2009-02-25 20:31 UTC (permalink / raw)
To: netdev; +Cc: kernel-janitors, linux-kernel
Impact: Attribute function with __acquires(...) resp. __releases(...).
Fix this sparse warnings:
net/802/tr.c:492:21: warning: context imbalance in 'rif_seq_start' - wrong count at exit
net/802/tr.c:519:13: warning: context imbalance in 'rif_seq_stop' - unexpected unlock
Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
net/802/tr.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/net/802/tr.c b/net/802/tr.c
index 158150f..dab6334 100644
--- a/net/802/tr.c
+++ b/net/802/tr.c
@@ -486,6 +486,7 @@ static struct rif_cache *rif_get_idx(loff_t pos)
}
static void *rif_seq_start(struct seq_file *seq, loff_t *pos)
+ __acquires(&rif_lock)
{
spin_lock_irq(&rif_lock);
@@ -517,6 +518,7 @@ static void *rif_seq_next(struct seq_file *seq, void *v, loff_t *pos)
}
static void rif_seq_stop(struct seq_file *seq, void *v)
+ __releases(&rif_lock)
{
spin_unlock_irq(&rif_lock);
}
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/8] 9p: fix sparse warning: cast adds address space
2009-02-25 20:31 [PATCH 0/8] net: fix (sparse) warnings Hannes Eder
2009-02-25 20:31 ` [PATCH 1/8] net/802: fix sparse warnings: context imbalance Hannes Eder
@ 2009-02-25 20:31 ` Hannes Eder
2009-02-25 20:31 ` [PATCH 3/8] appletalk: fix warning: format not a string literal and no Hannes Eder
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Hannes Eder @ 2009-02-25 20:31 UTC (permalink / raw)
To: netdev; +Cc: kernel-janitors, linux-kernel
Impact: Trust in the comment and add '__force' to the cast.
Fix this sparse warning:
net/9p/trans_fd.c:420:34: warning: cast adds address space to expression (<asn:1>)
Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
net/9p/trans_fd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 1df0356..c613ed0 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -417,7 +417,7 @@ static int p9_fd_write(struct p9_client *client, void *v, int len)
oldfs = get_fs();
set_fs(get_ds());
/* The cast to a user pointer is valid due to the set_fs() */
- ret = vfs_write(ts->wr, (void __user *)v, len, &ts->wr->f_pos);
+ ret = vfs_write(ts->wr, (__force void __user *)v, len, &ts->wr->f_pos);
set_fs(oldfs);
if (ret <= 0 && ret != -ERESTARTSYS && ret != -EAGAIN)
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/8] appletalk: fix warning: format not a string literal and no ...
2009-02-25 20:31 [PATCH 0/8] net: fix (sparse) warnings Hannes Eder
2009-02-25 20:31 ` [PATCH 1/8] net/802: fix sparse warnings: context imbalance Hannes Eder
2009-02-25 20:31 ` [PATCH 2/8] 9p: fix sparse warning: cast adds address space Hannes Eder
@ 2009-02-25 20:31 ` Hannes Eder
2009-02-25 20:32 ` [PATCH 4/8] [NET] sysctl: fix sparse warning: Should it be static? Hannes Eder
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Hannes Eder @ 2009-02-25 20:31 UTC (permalink / raw)
To: netdev; +Cc: kernel-janitors, linux-kernel
Impact: Use 'static const char[]' instead of 'static char[]', and
since the data is const now it can be placed in __initconst.
Fix this warning:
net/appletalk/ddp.c: In function 'atalk_init':
net/appletalk/ddp.c:1894: warning: format not a string literal and no format arguments
Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
net/appletalk/ddp.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 510a678..cf05c43 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1877,7 +1877,7 @@ EXPORT_SYMBOL(aarp_send_ddp);
EXPORT_SYMBOL(atrtr_get_dev);
EXPORT_SYMBOL(atalk_find_dev_addr);
-static char atalk_err_snap[] __initdata =
+static const char atalk_err_snap[] __initconst =
KERN_CRIT "Unable to register DDP with SNAP.\n";
/* Called by proto.c on kernel start up */
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/8] [NET] sysctl: fix sparse warning: Should it be static?
2009-02-25 20:31 [PATCH 0/8] net: fix (sparse) warnings Hannes Eder
` (2 preceding siblings ...)
2009-02-25 20:31 ` [PATCH 3/8] appletalk: fix warning: format not a string literal and no Hannes Eder
@ 2009-02-25 20:32 ` Hannes Eder
2009-02-25 20:32 ` [PATCH 5/8] decnet: fix sparse warnings: context imbalance Hannes Eder
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Hannes Eder @ 2009-02-25 20:32 UTC (permalink / raw)
To: netdev; +Cc: kernel-janitors, linux-kernel
Impact: Include header file.
Fix this sparse warning:
net/core/sysctl_net_core.c:123:32: warning: symbol 'net_core_path' was not declared. Should it be static?
Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
net/core/sysctl_net_core.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 83d3398..7db1de0 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -11,6 +11,7 @@
#include <linux/socket.h>
#include <linux/netdevice.h>
#include <linux/init.h>
+#include <net/ip.h>
#include <net/sock.h>
static struct ctl_table net_core_table[] = {
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/8] decnet: fix sparse warnings: context imbalance
2009-02-25 20:31 [PATCH 0/8] net: fix (sparse) warnings Hannes Eder
` (3 preceding siblings ...)
2009-02-25 20:32 ` [PATCH 4/8] [NET] sysctl: fix sparse warning: Should it be static? Hannes Eder
@ 2009-02-25 20:32 ` Hannes Eder
2009-02-25 20:32 ` [PATCH 6/8] decnet: fix sparse warnings: symbol shadows an earlier one Hannes Eder
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Hannes Eder @ 2009-02-25 20:32 UTC (permalink / raw)
To: netdev; +Cc: kernel-janitors, linux-kernel
Impact: Attribute functions with __acquires(...) resp. __releases(...).
Fix this sparse warnings:
net/decnet/dn_dev.c:1324:13: warning: context imbalance in 'dn_dev_seq_start' - wrong count at exit
net/decnet/dn_dev.c:1366:13: warning: context imbalance in 'dn_dev_seq_stop' - unexpected unlock
Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
net/decnet/dn_dev.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index daf2b98..5e21a2f 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -1322,6 +1322,7 @@ static inline int is_dn_dev(struct net_device *dev)
}
static void *dn_dev_seq_start(struct seq_file *seq, loff_t *pos)
+ __acquires(&dev_base_lock)
{
int i;
struct net_device *dev;
@@ -1364,6 +1365,7 @@ static void *dn_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
}
static void dn_dev_seq_stop(struct seq_file *seq, void *v)
+ __releases(&dev_base_lock)
{
read_unlock(&dev_base_lock);
}
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/8] decnet: fix sparse warnings: symbol shadows an earlier one
2009-02-25 20:31 [PATCH 0/8] net: fix (sparse) warnings Hannes Eder
` (4 preceding siblings ...)
2009-02-25 20:32 ` [PATCH 5/8] decnet: fix sparse warnings: context imbalance Hannes Eder
@ 2009-02-25 20:32 ` Hannes Eder
2009-02-25 20:32 ` [PATCH 7/8] inet fragments: fix sparse warning: context imbalance Hannes Eder
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Hannes Eder @ 2009-02-25 20:32 UTC (permalink / raw)
To: netdev; +Cc: kernel-janitors, linux-kernel
Impact: Remove redundant variable declarations, resp. rename
inner scope variable.
Fix this sparse warnings:
net/decnet/af_decnet.c:1252:40: warning: symbol 'skb' shadows an earlier one
net/decnet/af_decnet.c:1223:24: originally declared here
net/decnet/af_decnet.c:1582:29: warning: symbol 'val' shadows an earlier one
net/decnet/af_decnet.c:1527:22: originally declared here
net/decnet/dn_dev.c:687:21: warning: symbol 'err' shadows an earlier one
net/decnet/dn_dev.c:670:13: originally declared here
net/decnet/sysctl_net_decnet.c:182:21: warning: symbol 'len' shadows an earlier one
net/decnet/sysctl_net_decnet.c:173:16: originally declared here
Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
net/decnet/af_decnet.c | 17 +++++++++--------
net/decnet/dn_dev.c | 1 -
net/decnet/sysctl_net_decnet.c | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 12bf7d4..b66fb84 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -1246,11 +1246,12 @@ static int dn_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case TIOCINQ:
lock_sock(sk);
- if ((skb = skb_peek(&scp->other_receive_queue)) != NULL) {
+ skb = skb_peek(&scp->other_receive_queue);
+ if (skb) {
amount = skb->len;
} else {
- struct sk_buff *skb = sk->sk_receive_queue.next;
- for(;;) {
+ skb = sk->sk_receive_queue.next;
+ for (;;) {
if (skb ==
(struct sk_buff *)&sk->sk_receive_queue)
break;
@@ -1579,16 +1580,16 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us
default:
#ifdef CONFIG_NETFILTER
{
- int val, len;
+ int ret, len;
if(get_user(len, optlen))
return -EFAULT;
- val = nf_getsockopt(sk, PF_DECnet, optname,
+ ret = nf_getsockopt(sk, PF_DECnet, optname,
optval, &len);
- if (val >= 0)
- val = put_user(len, optlen);
- return val;
+ if (ret >= 0)
+ ret = put_user(len, optlen);
+ return ret;
}
#endif
case DSO_STREAM:
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 5e21a2f..31c37ac 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -684,7 +684,6 @@ static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
return -ENODEV;
if ((dn_db = dev->dn_ptr) == NULL) {
- int err;
dn_db = dn_dev_create(dev, &err);
if (!dn_db)
return err;
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c
index 965397a..5bcd592 100644
--- a/net/decnet/sysctl_net_decnet.c
+++ b/net/decnet/sysctl_net_decnet.c
@@ -179,7 +179,7 @@ static int dn_node_address_handler(ctl_table *table, int write,
}
if (write) {
- int len = (*lenp < DN_ASCBUF_LEN) ? *lenp : (DN_ASCBUF_LEN-1);
+ len = (*lenp < DN_ASCBUF_LEN) ? *lenp : (DN_ASCBUF_LEN-1);
if (copy_from_user(addr, buffer, len))
return -EFAULT;
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 7/8] inet fragments: fix sparse warning: context imbalance
2009-02-25 20:31 [PATCH 0/8] net: fix (sparse) warnings Hannes Eder
` (5 preceding siblings ...)
2009-02-25 20:32 ` [PATCH 6/8] decnet: fix sparse warnings: symbol shadows an earlier one Hannes Eder
@ 2009-02-25 20:32 ` Hannes Eder
2009-02-25 20:33 ` [PATCH 8/8] wanrouter: fix sparse warnings: " Hannes Eder
2009-02-27 7:13 ` [PATCH 0/8] net: fix (sparse) warnings David Miller
8 siblings, 0 replies; 10+ messages in thread
From: Hannes Eder @ 2009-02-25 20:32 UTC (permalink / raw)
To: netdev; +Cc: kernel-janitors, linux-kernel
Impact: Attribute function with __releases(...)
Fix this sparse warning:
net/ipv4/inet_fragment.c:276:35: warning: context imbalance in 'inet_frag_find' - unexpected unlock
Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
include/net/inet_frag.h | 3 ++-
net/ipv4/inet_fragment.c | 1 +
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index e081eef..39f2dc9 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -61,7 +61,8 @@ void inet_frag_destroy(struct inet_frag_queue *q,
struct inet_frags *f, int *work);
int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f);
struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
- struct inet_frags *f, void *key, unsigned int hash);
+ struct inet_frags *f, void *key, unsigned int hash)
+ __releases(&f->lock);
static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f)
{
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 6c52e08..eaf3e2c 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -267,6 +267,7 @@ static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf,
struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
struct inet_frags *f, void *key, unsigned int hash)
+ __releases(&f->lock)
{
struct inet_frag_queue *q;
struct hlist_node *n;
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 8/8] wanrouter: fix sparse warnings: context imbalance
2009-02-25 20:31 [PATCH 0/8] net: fix (sparse) warnings Hannes Eder
` (6 preceding siblings ...)
2009-02-25 20:32 ` [PATCH 7/8] inet fragments: fix sparse warning: context imbalance Hannes Eder
@ 2009-02-25 20:33 ` Hannes Eder
2009-02-27 7:13 ` [PATCH 0/8] net: fix (sparse) warnings David Miller
8 siblings, 0 replies; 10+ messages in thread
From: Hannes Eder @ 2009-02-25 20:33 UTC (permalink / raw)
To: netdev; +Cc: kernel-janitors, linux-kernel
Impact: Attribute functions with __acquires(...) resp. __releases(...).
Fix this sparse warnings:
net/wanrouter/wanproc.c:82:13: warning: context imbalance in 'r_start' - wrong count at exit
net/wanrouter/wanproc.c:103:13: warning: context imbalance in 'r_stop' - unexpected unlock
net/wanrouter/wanmain.c:765:13: warning: context imbalance in 'lock_adapter_irq' - wrong count at exit
net/wanrouter/wanmain.c:771:13: warning: context imbalance in 'unlock_adapter_irq' - unexpected unlock
Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
net/wanrouter/wanmain.c | 8 ++++++--
net/wanrouter/wanproc.c | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index 39701de..466e2d2 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -86,8 +86,10 @@ static int wanrouter_device_del_if(struct wan_device *wandev,
static struct wan_device *wanrouter_find_device(char *name);
static int wanrouter_delete_interface(struct wan_device *wandev, char *name);
-static void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags);
-static void unlock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags);
+static void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags)
+ __acquires(lock);
+static void unlock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags)
+ __releases(lock);
@@ -763,12 +765,14 @@ static int wanrouter_delete_interface(struct wan_device *wandev, char *name)
}
static void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags)
+ __acquires(lock)
{
spin_lock_irqsave(lock, *smp_flags);
}
static void unlock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags)
+ __releases(lock)
{
spin_unlock_irqrestore(lock, *smp_flags);
}
diff --git a/net/wanrouter/wanproc.c b/net/wanrouter/wanproc.c
index 267f7ff..c44d96b 100644
--- a/net/wanrouter/wanproc.c
+++ b/net/wanrouter/wanproc.c
@@ -80,6 +80,7 @@ static struct proc_dir_entry *proc_router;
* Iterator
*/
static void *r_start(struct seq_file *m, loff_t *pos)
+ __acquires(kernel_lock)
{
struct wan_device *wandev;
loff_t l = *pos;
@@ -101,6 +102,7 @@ static void *r_next(struct seq_file *m, void *v, loff_t *pos)
}
static void r_stop(struct seq_file *m, void *v)
+ __releases(kernel_lock)
{
unlock_kernel();
}
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/8] net: fix (sparse) warnings
2009-02-25 20:31 [PATCH 0/8] net: fix (sparse) warnings Hannes Eder
` (7 preceding siblings ...)
2009-02-25 20:33 ` [PATCH 8/8] wanrouter: fix sparse warnings: " Hannes Eder
@ 2009-02-27 7:13 ` David Miller
8 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2009-02-27 7:13 UTC (permalink / raw)
To: hannes; +Cc: netdev, kernel-janitors, linux-kernel
From: Hannes Eder <hannes@hanneseder.net>
Date: Wed, 25 Feb 2009 21:31:10 +0100
> The following series fixes some (sparse) warnings in net/.
>
> ---
>
> Hannes Eder (8):
> wanrouter: fix sparse warnings: context imbalance
> inet fragments: fix sparse warning: context imbalance
> decnet: fix sparse warnings: symbol shadows an earlier one
> decnet: fix sparse warnings: context imbalance
> [NET] sysctl: fix sparse warning: Should it be static?
> appletalk: fix warning: format not a string literal and no ...
> 9p: fix sparse warning: cast adds address space
> net/802: fix sparse warnings: context imbalance
All applied to net-next-2.6, thanks!
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-02-27 7:14 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-25 20:31 [PATCH 0/8] net: fix (sparse) warnings Hannes Eder
2009-02-25 20:31 ` [PATCH 1/8] net/802: fix sparse warnings: context imbalance Hannes Eder
2009-02-25 20:31 ` [PATCH 2/8] 9p: fix sparse warning: cast adds address space Hannes Eder
2009-02-25 20:31 ` [PATCH 3/8] appletalk: fix warning: format not a string literal and no Hannes Eder
2009-02-25 20:32 ` [PATCH 4/8] [NET] sysctl: fix sparse warning: Should it be static? Hannes Eder
2009-02-25 20:32 ` [PATCH 5/8] decnet: fix sparse warnings: context imbalance Hannes Eder
2009-02-25 20:32 ` [PATCH 6/8] decnet: fix sparse warnings: symbol shadows an earlier one Hannes Eder
2009-02-25 20:32 ` [PATCH 7/8] inet fragments: fix sparse warning: context imbalance Hannes Eder
2009-02-25 20:33 ` [PATCH 8/8] wanrouter: fix sparse warnings: " Hannes Eder
2009-02-27 7:13 ` [PATCH 0/8] net: fix (sparse) warnings David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).