netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: fix sparse warnings in SNMP_UPD_PO_STATS(_BH)
@ 2014-09-17 21:23 Sabrina Dubroca
  2014-09-17 22:43 ` Hannes Frederic Sowa
  2014-09-19 21:22 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Sabrina Dubroca @ 2014-09-17 21:23 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

ptr used to be a non __percpu pointer (result of a this_cpu_ptr
assignment, 7d720c3e4f0c4 ("percpu: add __percpu sparse annotations to
net")). Since d25398df59b56 ("net: avoid reloads in SNMP_UPD_PO_STATS"),
that's no longer the case, SNMP_UPD_PO_STATS uses this_cpu_add and ptr
is now __percpu.

Silence sparse warnings by preserving the original type and
annotation, and remove the out-of-date comment.

warning: incorrect type in initializer (different address spaces)
   expected unsigned long long *ptr
   got unsigned long long [noderef] <asn:3>*<noident>
warning: incorrect type in initializer (different address spaces)
   expected void const [noderef] <asn:3>*__vpp_verify
   got unsigned long long *<noident>
warning: incorrect type in initializer (different address spaces)
   expected void const [noderef] <asn:3>*__vpp_verify
   got unsigned long long *<noident>

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
 include/net/snmp.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/include/net/snmp.h b/include/net/snmp.h
index f1f27fdbb0d5..8fd2f498782e 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -146,19 +146,15 @@ struct linux_xfrm_mib {
 
 #define SNMP_ADD_STATS(mib, field, addend)	\
 			this_cpu_add(mib->mibs[field], addend)
-/*
- * Use "__typeof__(*mib) *ptr" instead of "__typeof__(mib) ptr"
- * to make @ptr a non-percpu pointer.
- */
 #define SNMP_UPD_PO_STATS(mib, basefield, addend)	\
 	do { \
-		__typeof__(*mib->mibs) *ptr = mib->mibs;	\
+		__typeof__((mib->mibs) + 0) ptr = mib->mibs;	\
 		this_cpu_inc(ptr[basefield##PKTS]);		\
 		this_cpu_add(ptr[basefield##OCTETS], addend);	\
 	} while (0)
 #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend)	\
 	do { \
-		__typeof__(*mib->mibs) *ptr = mib->mibs;	\
+		__typeof__((mib->mibs) + 0) ptr = mib->mibs;	\
 		__this_cpu_inc(ptr[basefield##PKTS]);		\
 		__this_cpu_add(ptr[basefield##OCTETS], addend);	\
 	} while (0)
-- 
2.1.0

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

* Re: [PATCH net-next] net: fix sparse warnings in SNMP_UPD_PO_STATS(_BH)
  2014-09-17 21:23 [PATCH net-next] net: fix sparse warnings in SNMP_UPD_PO_STATS(_BH) Sabrina Dubroca
@ 2014-09-17 22:43 ` Hannes Frederic Sowa
  2014-09-19 21:22 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Hannes Frederic Sowa @ 2014-09-17 22:43 UTC (permalink / raw)
  To: Sabrina Dubroca, David Miller; +Cc: netdev

On Wed, Sep 17, 2014, at 23:23, Sabrina Dubroca wrote:
> ptr used to be a non __percpu pointer (result of a this_cpu_ptr
> assignment, 7d720c3e4f0c4 ("percpu: add __percpu sparse annotations to
> net")). Since d25398df59b56 ("net: avoid reloads in SNMP_UPD_PO_STATS"),
> that's no longer the case, SNMP_UPD_PO_STATS uses this_cpu_add and ptr
> is now __percpu.
> 
> Silence sparse warnings by preserving the original type and
> annotation, and remove the out-of-date comment.
> 
> warning: incorrect type in initializer (different address spaces)
>    expected unsigned long long *ptr
>    got unsigned long long [noderef] <asn:3>*<noident>
> warning: incorrect type in initializer (different address spaces)
>    expected void const [noderef] <asn:3>*__vpp_verify
>    got unsigned long long *<noident>
> warning: incorrect type in initializer (different address spaces)
>    expected void const [noderef] <asn:3>*__vpp_verify
>    got unsigned long long *<noident>
> 
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>

Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

This clears up quite a lot of warnings in ipv6/mcast.c.

Thanks,
Hannes

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

* Re: [PATCH net-next] net: fix sparse warnings in SNMP_UPD_PO_STATS(_BH)
  2014-09-17 21:23 [PATCH net-next] net: fix sparse warnings in SNMP_UPD_PO_STATS(_BH) Sabrina Dubroca
  2014-09-17 22:43 ` Hannes Frederic Sowa
@ 2014-09-19 21:22 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-09-19 21:22 UTC (permalink / raw)
  To: sd; +Cc: netdev

From: Sabrina Dubroca <sd@queasysnail.net>
Date: Wed, 17 Sep 2014 23:23:12 +0200

> ptr used to be a non __percpu pointer (result of a this_cpu_ptr
> assignment, 7d720c3e4f0c4 ("percpu: add __percpu sparse annotations to
> net")). Since d25398df59b56 ("net: avoid reloads in SNMP_UPD_PO_STATS"),
> that's no longer the case, SNMP_UPD_PO_STATS uses this_cpu_add and ptr
> is now __percpu.
> 
> Silence sparse warnings by preserving the original type and
> annotation, and remove the out-of-date comment.
> 
> warning: incorrect type in initializer (different address spaces)
>    expected unsigned long long *ptr
>    got unsigned long long [noderef] <asn:3>*<noident>
> warning: incorrect type in initializer (different address spaces)
>    expected void const [noderef] <asn:3>*__vpp_verify
>    got unsigned long long *<noident>
> warning: incorrect type in initializer (different address spaces)
>    expected void const [noderef] <asn:3>*__vpp_verify
>    got unsigned long long *<noident>
> 
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>

Applied, thanks.

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

end of thread, other threads:[~2014-09-19 21:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-17 21:23 [PATCH net-next] net: fix sparse warnings in SNMP_UPD_PO_STATS(_BH) Sabrina Dubroca
2014-09-17 22:43 ` Hannes Frederic Sowa
2014-09-19 21:22 ` 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).