diff options
Diffstat (limited to 'net/packet')
-rw-r--r-- | net/packet/af_packet.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 8ec1bca7f859..20a1bd0e6549 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -2851,12 +2851,11 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, | |||
2851 | return -EOPNOTSUPP; | 2851 | return -EOPNOTSUPP; |
2852 | 2852 | ||
2853 | uaddr->sa_family = AF_PACKET; | 2853 | uaddr->sa_family = AF_PACKET; |
2854 | memset(uaddr->sa_data, 0, sizeof(uaddr->sa_data)); | ||
2854 | rcu_read_lock(); | 2855 | rcu_read_lock(); |
2855 | dev = dev_get_by_index_rcu(sock_net(sk), pkt_sk(sk)->ifindex); | 2856 | dev = dev_get_by_index_rcu(sock_net(sk), pkt_sk(sk)->ifindex); |
2856 | if (dev) | 2857 | if (dev) |
2857 | strncpy(uaddr->sa_data, dev->name, 14); | 2858 | strlcpy(uaddr->sa_data, dev->name, sizeof(uaddr->sa_data)); |
2858 | else | ||
2859 | memset(uaddr->sa_data, 0, 14); | ||
2860 | rcu_read_unlock(); | 2859 | rcu_read_unlock(); |
2861 | *uaddr_len = sizeof(*uaddr); | 2860 | *uaddr_len = sizeof(*uaddr); |
2862 | 2861 | ||