All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] sparse related patches
@ 2011-02-23 19:06 Stephen Hemminger
  2011-02-23 19:06 ` [PATCH 1/5] socket: suppress sparse warnings Stephen Hemminger
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Stephen Hemminger @ 2011-02-23 19:06 UTC (permalink / raw)
  To: davem; +Cc: netdev



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] socket: suppress sparse warnings
  2011-02-23 19:06 [PATCH 0/5] sparse related patches Stephen Hemminger
@ 2011-02-23 19:06 ` Stephen Hemminger
  2011-02-23 19:06 ` [PATCH 2/5] atl1[ce]: fix " Stephen Hemminger
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2011-02-23 19:06 UTC (permalink / raw)
  To: davem; +Cc: netdev

[-- Attachment #1: socket-sparse --]
[-- Type: text/plain, Size: 1122 bytes --]

Use __force to quiet sparse warnings for cases where the code
is simulating user space pointers.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/net/socket.c	2011-02-23 08:26:51.905069267 -0800
+++ b/net/socket.c	2011-02-23 08:26:59.005160474 -0800
@@ -2648,7 +2648,8 @@ static int bond_ioctl(struct net *net, u
 
 		old_fs = get_fs();
 		set_fs(KERNEL_DS);
-		err = dev_ioctl(net, cmd, &kifr);
+		err = dev_ioctl(net, cmd,
+				(struct ifreq __user __force *) &kifr);
 		set_fs(old_fs);
 
 		return err;
@@ -2757,7 +2758,7 @@ static int compat_sioc_ifmap(struct net
 
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
-	err = dev_ioctl(net, cmd, (void __user *)&ifr);
+	err = dev_ioctl(net, cmd, (void  __user __force *)&ifr);
 	set_fs(old_fs);
 
 	if (cmd == SIOCGIFMAP && !err) {
@@ -2862,7 +2863,8 @@ static int routing_ioctl(struct net *net
 		ret |= __get_user(rtdev, &(ur4->rt_dev));
 		if (rtdev) {
 			ret |= copy_from_user(devname, compat_ptr(rtdev), 15);
-			r4.rt_dev = devname; devname[15] = 0;
+			r4.rt_dev = (char __user __force *)devname;
+			devname[15] = 0;
 		} else
 			r4.rt_dev = NULL;
 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/5] atl1[ce]: fix sparse warnings
  2011-02-23 19:06 [PATCH 0/5] sparse related patches Stephen Hemminger
  2011-02-23 19:06 ` [PATCH 1/5] socket: suppress sparse warnings Stephen Hemminger
@ 2011-02-23 19:06 ` Stephen Hemminger
  2011-02-23 19:06 ` [PATCH 3/5] afkey: add sparse annotation about rcu Stephen Hemminger
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2011-02-23 19:06 UTC (permalink / raw)
  To: davem; +Cc: netdev

[-- Attachment #1: atl1c-sparse.patch --]
[-- Type: text/plain, Size: 1751 bytes --]

The dmaw_block is an enum and max_pay_load is u32. Therefore
sparse gives warning about comparison of unsigned and signed value.
Resolve by using min_t to force cast.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/atl1c/atl1c_main.c	2011-02-23 09:58:11.282457630 -0800
+++ b/drivers/net/atl1c/atl1c_main.c	2011-02-23 09:58:42.626823758 -0800
@@ -1102,10 +1102,10 @@ static void atl1c_configure_tx(struct at
 	AT_READ_REG(hw, REG_DEVICE_CTRL, &dev_ctrl_data);
 	max_pay_load  = (dev_ctrl_data >> DEVICE_CTRL_MAX_PAYLOAD_SHIFT) &
 			DEVICE_CTRL_MAX_PAYLOAD_MASK;
-	hw->dmaw_block = min(max_pay_load, hw->dmaw_block);
+	hw->dmaw_block = min_t(u32, max_pay_load, hw->dmaw_block);
 	max_pay_load  = (dev_ctrl_data >> DEVICE_CTRL_MAX_RREQ_SZ_SHIFT) &
 			DEVICE_CTRL_MAX_RREQ_SZ_MASK;
-	hw->dmar_block = min(max_pay_load, hw->dmar_block);
+	hw->dmar_block = min_t(u32, max_pay_load, hw->dmar_block);
 
 	txq_ctrl_data = (hw->tpd_burst & TXQ_NUM_TPD_BURST_MASK) <<
 			TXQ_NUM_TPD_BURST_SHIFT;
--- a/drivers/net/atl1e/atl1e_main.c	2011-02-23 09:58:52.594940247 -0800
+++ b/drivers/net/atl1e/atl1e_main.c	2011-02-23 09:59:03.859071913 -0800
@@ -932,11 +932,11 @@ static inline void atl1e_configure_tx(st
 	max_pay_load  = ((dev_ctrl_data >> DEVICE_CTRL_MAX_PAYLOAD_SHIFT)) &
 			DEVICE_CTRL_MAX_PAYLOAD_MASK;
 
-	hw->dmaw_block = min(max_pay_load, hw->dmaw_block);
+	hw->dmaw_block = min_t(u32, max_pay_load, hw->dmaw_block);
 
 	max_pay_load  = ((dev_ctrl_data >> DEVICE_CTRL_MAX_RREQ_SZ_SHIFT)) &
 			DEVICE_CTRL_MAX_RREQ_SZ_MASK;
-	hw->dmar_block = min(max_pay_load, hw->dmar_block);
+	hw->dmar_block = min_t(u32, max_pay_load, hw->dmar_block);
 
 	if (hw->nic_type != athr_l2e_revB)
 		AT_WRITE_REGW(hw, REG_TXQ_CTRL + 2,



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/5] afkey: add sparse annotation about rcu
  2011-02-23 19:06 [PATCH 0/5] sparse related patches Stephen Hemminger
  2011-02-23 19:06 ` [PATCH 1/5] socket: suppress sparse warnings Stephen Hemminger
  2011-02-23 19:06 ` [PATCH 2/5] atl1[ce]: fix " Stephen Hemminger
@ 2011-02-23 19:06 ` Stephen Hemminger
  2011-02-23 19:06 ` [PATCH 4/5] mqprio: cleanups Stephen Hemminger
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2011-02-23 19:06 UTC (permalink / raw)
  To: davem; +Cc: netdev

[-- Attachment #1: afkey-sparse --]
[-- Type: text/plain, Size: 604 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/net/key/af_key.c	2011-02-23 10:20:23.181943425 -0800
+++ b/net/key/af_key.c	2011-02-23 10:20:47.290221581 -0800
@@ -3655,6 +3655,7 @@ static int pfkey_seq_show(struct seq_fil
 }
 
 static void *pfkey_seq_start(struct seq_file *f, loff_t *ppos)
+	__acquires(rcu)
 {
 	struct net *net = seq_file_net(f);
 	struct netns_pfkey *net_pfkey = net_generic(net, pfkey_net_id);
@@ -3672,6 +3673,7 @@ static void *pfkey_seq_next(struct seq_f
 }
 
 static void pfkey_seq_stop(struct seq_file *f, void *v)
+	__releases(rcu)
 {
 	rcu_read_unlock();
 }



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/5] mqprio: cleanups
  2011-02-23 19:06 [PATCH 0/5] sparse related patches Stephen Hemminger
                   ` (2 preceding siblings ...)
  2011-02-23 19:06 ` [PATCH 3/5] afkey: add sparse annotation about rcu Stephen Hemminger
@ 2011-02-23 19:06 ` Stephen Hemminger
  2011-02-23 19:06 ` [PATCH 5/5] em_meta: fix sparse warning Stephen Hemminger
  2011-02-23 22:11 ` [PATCH 0/5] sparse related patches David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2011-02-23 19:06 UTC (permalink / raw)
  To: davem; +Cc: netdev

[-- Attachment #1: mqprio-sparse.patch --]
[-- Type: text/plain, Size: 914 bytes --]

* make qdisc_ops local 
* add sparse annotation about expected unlock/unlock in dump_class_stats
* fix indentation

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/net/sched/sch_mqprio.c	2011-02-23 10:22:17.171259588 -0800
+++ b/net/sched/sch_mqprio.c	2011-02-23 10:28:51.955835730 -0800
@@ -311,7 +311,9 @@ static int mqprio_dump_class(struct Qdis
 }
 
 static int mqprio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
-			       struct gnet_dump *d)
+				   struct gnet_dump *d)
+	__releases(d->lock)
+	__acquires(d->lock)
 {
 	struct net_device *dev = qdisc_dev(sch);
 
@@ -389,7 +391,7 @@ static const struct Qdisc_class_ops mqpr
 	.dump_stats	= mqprio_dump_class_stats,
 };
 
-struct Qdisc_ops mqprio_qdisc_ops __read_mostly = {
+static struct Qdisc_ops mqprio_qdisc_ops __read_mostly = {
 	.cl_ops		= &mqprio_class_ops,
 	.id		= "mqprio",
 	.priv_size	= sizeof(struct mqprio_sched),



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 5/5] em_meta: fix sparse warning
  2011-02-23 19:06 [PATCH 0/5] sparse related patches Stephen Hemminger
                   ` (3 preceding siblings ...)
  2011-02-23 19:06 ` [PATCH 4/5] mqprio: cleanups Stephen Hemminger
@ 2011-02-23 19:06 ` Stephen Hemminger
  2011-02-23 22:11 ` [PATCH 0/5] sparse related patches David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2011-02-23 19:06 UTC (permalink / raw)
  To: davem; +Cc: netdev

[-- Attachment #1: em-meta-sparse --]
[-- Type: text/plain, Size: 457 bytes --]

gfp_t needs to be cast to integer.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/net/sched/em_meta.c	2011-02-23 10:26:17.534042646 -0800
+++ b/net/sched/em_meta.c	2011-02-23 10:30:37.533063770 -0800
@@ -401,7 +401,7 @@ META_COLLECTOR(int_sk_sndbuf)
 META_COLLECTOR(int_sk_alloc)
 {
 	SKIP_NONLOCAL(skb);
-	dst->value = skb->sk->sk_allocation;
+	dst->value = (__force int) skb->sk->sk_allocation;
 }
 
 META_COLLECTOR(int_sk_route_caps)



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/5] sparse related patches
  2011-02-23 19:06 [PATCH 0/5] sparse related patches Stephen Hemminger
                   ` (4 preceding siblings ...)
  2011-02-23 19:06 ` [PATCH 5/5] em_meta: fix sparse warning Stephen Hemminger
@ 2011-02-23 22:11 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2011-02-23 22:11 UTC (permalink / raw)
  To: shemminger; +Cc: netdev


All applied, thanks Stephen.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-02-23 22:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-23 19:06 [PATCH 0/5] sparse related patches Stephen Hemminger
2011-02-23 19:06 ` [PATCH 1/5] socket: suppress sparse warnings Stephen Hemminger
2011-02-23 19:06 ` [PATCH 2/5] atl1[ce]: fix " Stephen Hemminger
2011-02-23 19:06 ` [PATCH 3/5] afkey: add sparse annotation about rcu Stephen Hemminger
2011-02-23 19:06 ` [PATCH 4/5] mqprio: cleanups Stephen Hemminger
2011-02-23 19:06 ` [PATCH 5/5] em_meta: fix sparse warning Stephen Hemminger
2011-02-23 22:11 ` [PATCH 0/5] sparse related patches David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.