diff options
Diffstat (limited to 'net/ipv6/ping.c')
-rw-r--r-- | net/ipv6/ping.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c index fee25c0..263a516 100644 --- a/net/ipv6/ping.c +++ b/net/ipv6/ping.c @@ -101,9 +101,10 @@ int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) if (msg->msg_name) { DECLARE_SOCKADDR(struct sockaddr_in6 *, u, msg->msg_name); - if (msg->msg_namelen < sizeof(struct sockaddr_in6) || - u->sin6_family != AF_INET6) { + if (msg->msg_namelen < sizeof(*u)) return -EINVAL; + if (u->sin6_family != AF_INET6) { + return -EAFNOSUPPORT; } if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != u->sin6_scope_id) { |