aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ping.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ping.c')
-rw-r--r--net/ipv4/ping.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 208d5439e59b..a93f260cf24c 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -64,11 +64,11 @@ EXPORT_SYMBOL_GPL(pingv6_ops);
64 64
65static u16 ping_port_rover; 65static u16 ping_port_rover;
66 66
67static inline int ping_hashfn(struct net *net, unsigned int num, unsigned int mask) 67static inline u32 ping_hashfn(const struct net *net, u32 num, u32 mask)
68{ 68{
69 int res = (num + net_hash_mix(net)) & mask; 69 u32 res = (num + net_hash_mix(net)) & mask;
70 70
71 pr_debug("hash(%d) = %d\n", num, res); 71 pr_debug("hash(%u) = %u\n", num, res);
72 return res; 72 return res;
73} 73}
74EXPORT_SYMBOL_GPL(ping_hash); 74EXPORT_SYMBOL_GPL(ping_hash);
@@ -516,7 +516,7 @@ void ping_err(struct sk_buff *skb, int offset, u32 info)
516 ntohs(icmph->un.echo.sequence)); 516 ntohs(icmph->un.echo.sequence));
517 517
518 sk = ping_lookup(net, skb, ntohs(icmph->un.echo.id)); 518 sk = ping_lookup(net, skb, ntohs(icmph->un.echo.id));
519 if (sk == NULL) { 519 if (!sk) {
520 pr_debug("no socket, dropping\n"); 520 pr_debug("no socket, dropping\n");
521 return; /* No socket for error */ 521 return; /* No socket for error */
522 } 522 }
@@ -692,8 +692,7 @@ int ping_common_sendmsg(int family, struct msghdr *msg, size_t len,
692} 692}
693EXPORT_SYMBOL_GPL(ping_common_sendmsg); 693EXPORT_SYMBOL_GPL(ping_common_sendmsg);
694 694
695static int ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 695static int ping_v4_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
696 size_t len)
697{ 696{
698 struct net *net = sock_net(sk); 697 struct net *net = sock_net(sk);
699 struct flowi4 fl4; 698 struct flowi4 fl4;
@@ -849,8 +848,8 @@ do_confirm:
849 goto out; 848 goto out;
850} 849}
851 850
852int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 851int ping_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock,
853 size_t len, int noblock, int flags, int *addr_len) 852 int flags, int *addr_len)
854{ 853{
855 struct inet_sock *isk = inet_sk(sk); 854 struct inet_sock *isk = inet_sk(sk);
856 int family = sk->sk_family; 855 int family = sk->sk_family;
@@ -972,7 +971,7 @@ bool ping_rcv(struct sk_buff *skb)
972 skb_push(skb, skb->data - (u8 *)icmph); 971 skb_push(skb, skb->data - (u8 *)icmph);
973 972
974 sk = ping_lookup(net, skb, ntohs(icmph->un.echo.id)); 973 sk = ping_lookup(net, skb, ntohs(icmph->un.echo.id));
975 if (sk != NULL) { 974 if (sk) {
976 struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); 975 struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
977 976
978 pr_debug("rcv on socket %p\n", sk); 977 pr_debug("rcv on socket %p\n", sk);