All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ip_vti: fix sparse warnings for VTI_ISVTI
@ 2014-06-11 11:09 Dmitry Popov
  2014-06-11 12:02 ` Dmitry Popov
  2014-06-11 22:41 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Popov @ 2014-06-11 11:09 UTC (permalink / raw)
  To: David S. Miller, Steffen Klassert; +Cc: netdev, linux-kernel, trivial

This patch fixes the following sparse warnings:

net/ipv4/ip_tunnel.c:245:53: warning: restricted __be16 degrades to integer
net/ipv4/ip_vti.c:321:19: warning: incorrect type in assignment (different base types)
net/ipv4/ip_vti.c:321:19:    expected restricted __be16 [addressable] [assigned] [usertype] i_flags
net/ipv4/ip_vti.c:321:19:    got int
net/ipv4/ip_vti.c:447:24: warning: incorrect type in assignment (different base types)
net/ipv4/ip_vti.c:447:24:    expected restricted __be16 [usertype] i_flags
net/ipv4/ip_vti.c:447:24:    got int

Since VTI_ISVTI is always used with ip_tunnel_parm->i_flags (which is __be16),
we can __force cast VTI_ISVTI to __be16 in header file.

Signed-off-by: Dmitry Popov <ixaphire@qrator.net>
---
 include/uapi/linux/if_tunnel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index aee73d0..3bce9e9 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -100,7 +100,7 @@ enum {
 #define IFLA_GRE_MAX	(__IFLA_GRE_MAX - 1)
 
 /* VTI-mode i_flags */
-#define VTI_ISVTI 0x0001
+#define VTI_ISVTI ((__force __be16)0x0001)
 
 enum {
 	IFLA_VTI_UNSPEC,

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

* Re: [PATCH] ip_vti: fix sparse warnings for VTI_ISVTI
  2014-06-11 11:09 [PATCH] ip_vti: fix sparse warnings for VTI_ISVTI Dmitry Popov
@ 2014-06-11 12:02 ` Dmitry Popov
  2014-06-11 15:40   ` Stephen Hemminger
  2014-06-11 22:41 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Dmitry Popov @ 2014-06-11 12:02 UTC (permalink / raw)
  To: Dmitry Popov, Stephen Hemminger
  Cc: David S. Miller, Steffen Klassert, netdev, linux-kernel, trivial

On Wed, 11 Jun 2014 15:09:14 +0400
Dmitry Popov <ixaphire@qrator.net> wrote:

> 
> Since VTI_ISVTI is always used with ip_tunnel_parm->i_flags (which is __be16),
> we can __force cast VTI_ISVTI to __be16 in header file.
> 

If this patch is okay I will submit it to iproute2 too. if_tunnel.h has to be
synced.

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

* Re: [PATCH] ip_vti: fix sparse warnings for VTI_ISVTI
  2014-06-11 12:02 ` Dmitry Popov
@ 2014-06-11 15:40   ` Stephen Hemminger
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2014-06-11 15:40 UTC (permalink / raw)
  To: Dmitry Popov
  Cc: David S. Miller, Steffen Klassert, netdev, linux-kernel, trivial

On Wed, 11 Jun 2014 16:02:15 +0400
Dmitry Popov <ixaphire@qrator.net> wrote:

> On Wed, 11 Jun 2014 15:09:14 +0400
> Dmitry Popov <ixaphire@qrator.net> wrote:
> 
> > 
> > Since VTI_ISVTI is always used with ip_tunnel_parm->i_flags (which is __be16),
> > we can __force cast VTI_ISVTI to __be16 in header file.
> > 
> 
> If this patch is okay I will submit it to iproute2 too. if_tunnel.h has to be
> synced.

don't bother with iproute2 patch. I periodically resync sanitized headers from
kernel to iproute2.

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

* Re: [PATCH] ip_vti: fix sparse warnings for VTI_ISVTI
  2014-06-11 11:09 [PATCH] ip_vti: fix sparse warnings for VTI_ISVTI Dmitry Popov
  2014-06-11 12:02 ` Dmitry Popov
@ 2014-06-11 22:41 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2014-06-11 22:41 UTC (permalink / raw)
  To: ixaphire; +Cc: steffen.klassert, netdev, linux-kernel, trivial

From: Dmitry Popov <ixaphire@qrator.net>
Date: Wed, 11 Jun 2014 15:09:14 +0400

> This patch fixes the following sparse warnings:
> 
> net/ipv4/ip_tunnel.c:245:53: warning: restricted __be16 degrades to integer
> net/ipv4/ip_vti.c:321:19: warning: incorrect type in assignment (different base types)
> net/ipv4/ip_vti.c:321:19:    expected restricted __be16 [addressable] [assigned] [usertype] i_flags
> net/ipv4/ip_vti.c:321:19:    got int
> net/ipv4/ip_vti.c:447:24: warning: incorrect type in assignment (different base types)
> net/ipv4/ip_vti.c:447:24:    expected restricted __be16 [usertype] i_flags
> net/ipv4/ip_vti.c:447:24:    got int
> 
> Since VTI_ISVTI is always used with ip_tunnel_parm->i_flags (which is __be16),
> we can __force cast VTI_ISVTI to __be16 in header file.
> 
> Signed-off-by: Dmitry Popov <ixaphire@qrator.net>

Applied.

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

end of thread, other threads:[~2014-06-11 22:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-11 11:09 [PATCH] ip_vti: fix sparse warnings for VTI_ISVTI Dmitry Popov
2014-06-11 12:02 ` Dmitry Popov
2014-06-11 15:40   ` Stephen Hemminger
2014-06-11 22:41 ` 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.