linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [can:for-davem 18/19] net/can/gw.c:370:13: sparse: restricted __wsum degrades to integer
@ 2013-01-23  1:26 kbuild test robot
  2013-01-23  9:06 ` Oliver Hartkopp
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2013-01-23  1:26 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: linux-can, Marc Kleine-Budde

tree:   git://gitorious.org/linux-can/linux-can-next for-davem
head:   565836761aa8096f568c021f709a84076f35976a
commit: 0bb45781da3270edfaf854b0dd9a40aca49c15dc [18/19] can: gw: add a variable limit for CAN frame routings


sparse warnings: (new ones prefixed by >>)

>> net/can/gw.c:370:13: sparse: restricted __wsum degrades to integer
   net/can/gw.c:402:26: sparse: restricted __wsum degrades to integer
>> net/can/gw.c:402:24: sparse: incorrect type in assignment (different base types)
   net/can/gw.c:402:24:    expected restricted __wsum [usertype] csum
   net/can/gw.c:402:24:    got unsigned int

vim +370 net/can/gw.c

   364		 */
   365	
   366	#define cgw_hops(skb) ((skb)->csum)
   367	
   368		BUG_ON(skb->ip_summed != CHECKSUM_UNNECESSARY);
   369	
 > 370		if (cgw_hops(skb) >= max_hops)
   371			return;
   372	
   373		if (!(gwj->dst.dev->flags & IFF_UP)) {
   374			gwj->dropped_frames++;
   375			return;
   376		}
   377	
   378		/* is sending the skb back to the incoming interface not allowed? */
   379		if (!(gwj->flags & CGW_FLAGS_CAN_IIF_TX_OK) &&
   380		    skb_headroom(skb) == sizeof(struct can_skb_priv) &&
   381		    (((struct can_skb_priv *)(skb->head))->ifindex ==
   382		     gwj->dst.dev->ifindex))
   383			return;
   384	
   385		/*
   386		 * clone the given skb, which has not been done in can_rcv()
   387		 *
   388		 * When there is at least one modification function activated,
   389		 * we need to copy the skb as we want to modify skb->data.
   390		 */
   391		if (gwj->mod.modfunc[0])
   392			nskb = skb_copy(skb, GFP_ATOMIC);
   393		else
   394			nskb = skb_clone(skb, GFP_ATOMIC);
   395	
   396		if (!nskb) {
   397			gwj->dropped_frames++;
   398			return;
   399		}
   400	
   401		/* put the incremented hop counter in the cloned skb */
   402		cgw_hops(nskb) = cgw_hops(skb) + 1;
   403		nskb->dev = gwj->dst.dev;
   404	
   405		/* pointer to modifiable CAN frame */

---
0-DAY kernel build testing backend              Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild                 Intel Corporation

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

* Re: [can:for-davem 18/19] net/can/gw.c:370:13: sparse: restricted __wsum degrades to integer
  2013-01-23  1:26 [can:for-davem 18/19] net/can/gw.c:370:13: sparse: restricted __wsum degrades to integer kbuild test robot
@ 2013-01-23  9:06 ` Oliver Hartkopp
  2013-01-23  9:18   ` Marc Kleine-Budde
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Hartkopp @ 2013-01-23  9:06 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can

Hello Marc,

it was hard to make sparse to give this warning on my machine ...

For the records:

	make C=1 CF="-D__CHECK_ENDIAN__"

made it :-)


I pushed a new commit to the cangw branch of ollis-can-next:

https://gitorious.org/~hartkopp/linux-can/ollis-can-next/commits/cangw

The commit is 

https://gitorious.org/~hartkopp/linux-can/ollis-can-next/commit/4068160ad6f42436a40edf4b04ec47e86399b544

Please pull.

Thanks!

From 4068160ad6f42436a40edf4b04ec47e86399b544 Mon Sep 17 00:00:00 2001
From: Oliver Hartkopp <socketcan@hartkopp.net>
Date: Wed, 23 Jan 2013 09:45:39 +0100
Subject: [PATCH] can-gw: fix sparse warning

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
---
 net/can/gw.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/can/gw.c b/net/can/gw.c
index e12666e..acdd465 100644
--- a/net/can/gw.c
+++ b/net/can/gw.c
@@ -359,12 +359,12 @@ static void can_can_gw_rcv(struct sk_buff *skb, void *data)
 	 *
 	 * The Controller Area Network controllers only accept CAN frames with
 	 * correct CRCs - which are not visible in the controller registers.
-	 * According to skbuff.h documentation the csum element for IP checksums
-	 * is undefined/unsued when ip_summed == CHECKSUM_UNNECESSARY. Only
-	 * CAN skbs can be processed here which already have this property.
+	 * According to skbuff.h documentation the csum_start element for IP
+	 * checksums is undefined/unsued when ip_summed == CHECKSUM_UNNECESSARY.
+	 * Only CAN skbs can be processed here which already have this property.
 	 */
 
-#define cgw_hops(skb) ((skb)->csum)
+#define cgw_hops(skb) ((skb)->csum_start)
 
 	BUG_ON(skb->ip_summed != CHECKSUM_UNNECESSARY);
 
-- 
1.7.1



On 23.01.2013 02:26, kbuild test robot wrote:

> tree:   git://gitorious.org/linux-can/linux-can-next for-davem
> head:   565836761aa8096f568c021f709a84076f35976a
> commit: 0bb45781da3270edfaf854b0dd9a40aca49c15dc [18/19] can: gw: add a variable limit for CAN frame routings
> 
> 
> sparse warnings: (new ones prefixed by >>)
> 
>>> net/can/gw.c:370:13: sparse: restricted __wsum degrades to integer
>    net/can/gw.c:402:26: sparse: restricted __wsum degrades to integer
>>> net/can/gw.c:402:24: sparse: incorrect type in assignment (different base types)
>    net/can/gw.c:402:24:    expected restricted __wsum [usertype] csum
>    net/can/gw.c:402:24:    got unsigned int
> 



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

* Re: [can:for-davem 18/19] net/can/gw.c:370:13: sparse: restricted __wsum degrades to integer
  2013-01-23  9:06 ` Oliver Hartkopp
@ 2013-01-23  9:18   ` Marc Kleine-Budde
  0 siblings, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2013-01-23  9:18 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 942 bytes --]

On 01/23/2013 10:06 AM, Oliver Hartkopp wrote:
> Hello Marc,
> 
> it was hard to make sparse to give this warning on my machine ...
> 
> For the records:
> 
> 	make C=1 CF="-D__CHECK_ENDIAN__"
> 
> made it :-)
> 
> 
> I pushed a new commit to the cangw branch of ollis-can-next:
> 
> https://gitorious.org/~hartkopp/linux-can/ollis-can-next/commits/cangw
> 
> The commit is 
> 
> https://gitorious.org/~hartkopp/linux-can/ollis-can-next/commit/4068160ad6f42436a40edf4b04ec47e86399b544

I've squashed the commit into "can: gw: add a variable limit for CAN
frame routings" and pushed the resulting tree to linux-can-next/for-davem

tnx,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

end of thread, other threads:[~2013-01-23  9:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-23  1:26 [can:for-davem 18/19] net/can/gw.c:370:13: sparse: restricted __wsum degrades to integer kbuild test robot
2013-01-23  9:06 ` Oliver Hartkopp
2013-01-23  9:18   ` Marc Kleine-Budde

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).