提交 7c0cadc6 编写于 作者: E Eric Dumazet 提交者: David S. Miller

udp: fix two sparse errors

commit ba418fa3 ("soreuseport: UDP/IPv4 implementation")
added following sparse errors :

net/ipv4/udp.c:433:60: warning: cast from restricted __be16
net/ipv4/udp.c:433:60: warning: incorrect type in argument 1 (different base types)
net/ipv4/udp.c:433:60:    expected unsigned short [unsigned] [usertype] val
net/ipv4/udp.c:433:60:    got restricted __be16 [usertype] sport
net/ipv4/udp.c:433:60: warning: cast from restricted __be16
net/ipv4/udp.c:433:60: warning: cast from restricted __be16
net/ipv4/udp.c:514:60: warning: cast from restricted __be16
net/ipv4/udp.c:514:60: warning: incorrect type in argument 1 (different base types)
net/ipv4/udp.c:514:60:    expected unsigned short [unsigned] [usertype] val
net/ipv4/udp.c:514:60:    got restricted __be16 [usertype] sport
net/ipv4/udp.c:514:60: warning: cast from restricted __be16
net/ipv4/udp.c:514:60: warning: cast from restricted __be16
Signed-off-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 5b9b6263
...@@ -430,7 +430,7 @@ static struct sock *udp4_lib_lookup2(struct net *net, ...@@ -430,7 +430,7 @@ static struct sock *udp4_lib_lookup2(struct net *net,
reuseport = sk->sk_reuseport; reuseport = sk->sk_reuseport;
if (reuseport) { if (reuseport) {
hash = inet_ehashfn(net, daddr, hnum, hash = inet_ehashfn(net, daddr, hnum,
saddr, htons(sport)); saddr, sport);
matches = 1; matches = 1;
} }
} else if (score == badness && reuseport) { } else if (score == badness && reuseport) {
...@@ -511,7 +511,7 @@ struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, ...@@ -511,7 +511,7 @@ struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
reuseport = sk->sk_reuseport; reuseport = sk->sk_reuseport;
if (reuseport) { if (reuseport) {
hash = inet_ehashfn(net, daddr, hnum, hash = inet_ehashfn(net, daddr, hnum,
saddr, htons(sport)); saddr, sport);
matches = 1; matches = 1;
} }
} else if (score == badness && reuseport) { } else if (score == badness && reuseport) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册