mirror of
https://github.com/torvalds/linux.git
synced 2024-11-16 00:52:01 +00:00
vxlan: fix sparse warnings
Sparse reports false positives for the header manipulation inlines. Annotate
them correctly.
Tested by sparse on a little endian and big endian machine.
Fixes: 54bfd872bf
("vxlan: keep flags and vni in network byte order")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ed49e65037
commit
5692d7ea41
@ -271,36 +271,36 @@ static inline struct vxlanhdr *vxlan_hdr(struct sk_buff *skb)
|
||||
static inline __be32 vxlan_vni(__be32 vni_field)
|
||||
{
|
||||
#if defined(__BIG_ENDIAN)
|
||||
return vni_field >> 8;
|
||||
return (__force __be32)((__force u32)vni_field >> 8);
|
||||
#else
|
||||
return (vni_field & VXLAN_VNI_MASK) << 8;
|
||||
return (__force __be32)((__force u32)(vni_field & VXLAN_VNI_MASK) << 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline __be32 vxlan_vni_field(__be32 vni)
|
||||
{
|
||||
#if defined(__BIG_ENDIAN)
|
||||
return vni << 8;
|
||||
return (__force __be32)((__force u32)vni << 8);
|
||||
#else
|
||||
return vni >> 8;
|
||||
return (__force __be32)((__force u32)vni >> 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline __be32 vxlan_tun_id_to_vni(__be64 tun_id)
|
||||
{
|
||||
#if defined(__BIG_ENDIAN)
|
||||
return tun_id;
|
||||
return (__force __be32)tun_id;
|
||||
#else
|
||||
return tun_id >> 32;
|
||||
return (__force __be32)((__force u64)tun_id >> 32);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline __be64 vxlan_vni_to_tun_id(__be32 vni)
|
||||
{
|
||||
#if defined(__BIG_ENDIAN)
|
||||
return (__be64)vni;
|
||||
return (__force __be64)vni;
|
||||
#else
|
||||
return (__be64)vni << 32;
|
||||
return (__force __be64)((u64)(__force u32)vni << 32);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user