* [PATCH] af_packet: use sizeof instead of constant in spkt_device
@ 2012-06-10 18:59 Daniel Borkmann
2012-06-11 23:52 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Borkmann @ 2012-06-10 18:59 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev@vger.kernel.org
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 <daniel.borkmann@tik.ee.ethz.ch>
---
net/packet/af_packet.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 0f66174..06ff8e1 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1476,7 +1476,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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] af_packet: use sizeof instead of constant in spkt_device
2012-06-10 18:59 [PATCH] af_packet: use sizeof instead of constant in spkt_device Daniel Borkmann
@ 2012-06-11 23:52 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-06-11 23:52 UTC (permalink / raw)
To: danborkmann; +Cc: netdev
From: Daniel Borkmann <danborkmann@iogearbox.net>
Date: Sun, 10 Jun 2012 20:59:28 +0200
> 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 <daniel.borkmann@tik.ee.ethz.ch>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-11 23:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-10 18:59 [PATCH] af_packet: use sizeof instead of constant in spkt_device Daniel Borkmann
2012-06-11 23:52 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).