net: fix (sparse) warnings
Subsystems (5)
cover net: fix (sparse) warnings
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(-)
PATCH 1/8 net/802: fix sparse warnings: context imbalance
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
--- net/802/tr.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
net/802/tr.c +2 -0
@@ -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); }
PATCH 2/8 9p: fix sparse warning: cast adds address space
In reply to Hannes EderImpact: 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>)
--- net/9p/trans_fd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/9p/trans_fd.c +1 -1
@@ -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 )
PATCH 3/8 appletalk: fix warning: format not a string literal and no ...
In reply to Hannes EderImpact: 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
--- net/appletalk/ddp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/appletalk/ddp.c +0 -1
@@ -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 */
PATCH 4/8 sysctl: fix sparse warning: Should it be static?
In reply to Hannes EderImpact: 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?
--- net/core/sysctl_net_core.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
net/core/sysctl_net_core.c +1 -0
@@ -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[] = {
PATCH 5/8 decnet: fix sparse warnings: context imbalance
In reply to Hannes EderImpact: 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
--- net/decnet/dn_dev.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
net/decnet/dn_dev.c +2 -0
@@ -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); }
PATCH 6/8 decnet: fix sparse warnings: symbol shadows an earlier one
In reply to Hannes EderImpact: 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
--- 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(-)
net/decnet/af_decnet.c +9 -8
@@ -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 __usdefault :#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 :
net/decnet/dn_dev.c +0 -1
@@ -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;
net/decnet/sysctl_net_decnet.c +1 -1
@@ -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 ;
PATCH 7/8 inet fragments: fix sparse warning: context imbalance
In reply to Hannes EderImpact: Attribute function with __releases(...)
Fix this sparse warning:
net/ipv4/inet_fragment.c:276:35: warning: context imbalance in 'inet_frag_find' - unexpected unlock
--- include/net/inet_frag.h | 3 ++- net/ipv4/inet_fragment.c | 1 + 2 files changed, 3 insertions(+), 1 deletions(-)
include/net/inet_frag.h +2 -1
@@ -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) {
net/ipv4/inet_fragment.c +1 -0
@@ -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;
PATCH 8/8 wanrouter: fix sparse warnings: context imbalance
In reply to Hannes EderImpact: 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
--- net/wanrouter/wanmain.c | 8 ++++++-- net/wanrouter/wanproc.c | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)
net/wanrouter/wanmain.c +6 -2
@@ -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); }
net/wanrouter/wanproc.c +2 -0
@@ -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 (); }
David Miller
maintainerFrom: Hannes Eder <[email protected]>
Date: Wed, 25 Feb 2009 21:31:10 +0100
Quoted 4 lines
The following series fixes some (sparse) warnings in
net/.---
Quoted 9 lines
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!