提交 3e97fa70 编写于 作者: S Sabrina Dubroca 提交者: David S. Miller

gre/ipip: use be16 variants of netlink functions

encap.sport and encap.dport are __be16, use nla_{get,put}_be16 instead
of nla_{get,put}_u16.

Fixes the sparse warnings:

warning: incorrect type in assignment (different base types)
   expected restricted __be32 [addressable] [usertype] o_key
   got restricted __be16 [addressable] [usertype] i_flags
warning: incorrect type in assignment (different base types)
   expected restricted __be16 [usertype] sport
   got unsigned short
warning: incorrect type in assignment (different base types)
   expected restricted __be16 [usertype] dport
   got unsigned short
warning: incorrect type in argument 3 (different base types)
   expected unsigned short [unsigned] [usertype] value
   got restricted __be16 [usertype] sport
warning: incorrect type in argument 3 (different base types)
   expected unsigned short [unsigned] [usertype] value
   got restricted __be16 [usertype] dport
Signed-off-by: NSabrina Dubroca <sd@queasysnail.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 51a00daf
...@@ -659,12 +659,12 @@ static bool ipgre_netlink_encap_parms(struct nlattr *data[], ...@@ -659,12 +659,12 @@ static bool ipgre_netlink_encap_parms(struct nlattr *data[],
if (data[IFLA_GRE_ENCAP_SPORT]) { if (data[IFLA_GRE_ENCAP_SPORT]) {
ret = true; ret = true;
ipencap->sport = nla_get_u16(data[IFLA_GRE_ENCAP_SPORT]); ipencap->sport = nla_get_be16(data[IFLA_GRE_ENCAP_SPORT]);
} }
if (data[IFLA_GRE_ENCAP_DPORT]) { if (data[IFLA_GRE_ENCAP_DPORT]) {
ret = true; ret = true;
ipencap->dport = nla_get_u16(data[IFLA_GRE_ENCAP_DPORT]); ipencap->dport = nla_get_be16(data[IFLA_GRE_ENCAP_DPORT]);
} }
return ret; return ret;
...@@ -786,9 +786,9 @@ static int ipgre_fill_info(struct sk_buff *skb, const struct net_device *dev) ...@@ -786,9 +786,9 @@ static int ipgre_fill_info(struct sk_buff *skb, const struct net_device *dev)
if (nla_put_u16(skb, IFLA_GRE_ENCAP_TYPE, if (nla_put_u16(skb, IFLA_GRE_ENCAP_TYPE,
t->encap.type) || t->encap.type) ||
nla_put_u16(skb, IFLA_GRE_ENCAP_SPORT, nla_put_be16(skb, IFLA_GRE_ENCAP_SPORT,
t->encap.sport) || t->encap.sport) ||
nla_put_u16(skb, IFLA_GRE_ENCAP_DPORT, nla_put_be16(skb, IFLA_GRE_ENCAP_DPORT,
t->encap.dport) || t->encap.dport) ||
nla_put_u16(skb, IFLA_GRE_ENCAP_FLAGS, nla_put_u16(skb, IFLA_GRE_ENCAP_FLAGS,
t->encap.flags)) t->encap.flags))
......
...@@ -366,12 +366,12 @@ static bool ipip_netlink_encap_parms(struct nlattr *data[], ...@@ -366,12 +366,12 @@ static bool ipip_netlink_encap_parms(struct nlattr *data[],
if (data[IFLA_IPTUN_ENCAP_SPORT]) { if (data[IFLA_IPTUN_ENCAP_SPORT]) {
ret = true; ret = true;
ipencap->sport = nla_get_u16(data[IFLA_IPTUN_ENCAP_SPORT]); ipencap->sport = nla_get_be16(data[IFLA_IPTUN_ENCAP_SPORT]);
} }
if (data[IFLA_IPTUN_ENCAP_DPORT]) { if (data[IFLA_IPTUN_ENCAP_DPORT]) {
ret = true; ret = true;
ipencap->dport = nla_get_u16(data[IFLA_IPTUN_ENCAP_DPORT]); ipencap->dport = nla_get_be16(data[IFLA_IPTUN_ENCAP_DPORT]);
} }
return ret; return ret;
...@@ -460,9 +460,9 @@ static int ipip_fill_info(struct sk_buff *skb, const struct net_device *dev) ...@@ -460,9 +460,9 @@ static int ipip_fill_info(struct sk_buff *skb, const struct net_device *dev)
if (nla_put_u16(skb, IFLA_IPTUN_ENCAP_TYPE, if (nla_put_u16(skb, IFLA_IPTUN_ENCAP_TYPE,
tunnel->encap.type) || tunnel->encap.type) ||
nla_put_u16(skb, IFLA_IPTUN_ENCAP_SPORT, nla_put_be16(skb, IFLA_IPTUN_ENCAP_SPORT,
tunnel->encap.sport) || tunnel->encap.sport) ||
nla_put_u16(skb, IFLA_IPTUN_ENCAP_DPORT, nla_put_be16(skb, IFLA_IPTUN_ENCAP_DPORT,
tunnel->encap.dport) || tunnel->encap.dport) ||
nla_put_u16(skb, IFLA_IPTUN_ENCAP_FLAGS, nla_put_u16(skb, IFLA_IPTUN_ENCAP_FLAGS,
tunnel->encap.flags)) tunnel->encap.flags))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册