From: danborkmann@iogearbox.net Date: Sun, 10 Jun 2012 08:59:28 +0000 (+0000) Subject: af_packet: use sizeof instead of constant in spkt_device X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=de74e92aa8a44d0b80a53601dc4f6dd6afcb8453;p=linux-beck.git af_packet: use sizeof instead of constant in spkt_device This small patch removes access to the last element of the spkt_device array through a constant. Instead, it is accessed by sizeof() to respect possible changes in if_packet.h. Signed-off-by: Daniel Borkmann Signed-off-by: David S. Miller --- diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 71ac6559e0c6..8a10d5b3c832 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -1475,7 +1475,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, * Find the device first to size check it */ - saddr->spkt_device[13] = 0; + saddr->spkt_device[sizeof(saddr->spkt_device) - 1] = 0; retry: rcu_read_lock(); dev = dev_get_by_name_rcu(sock_net(sk), saddr->spkt_device);