From patchwork Sun Jun 10 18:59:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: danborkmann@iogearbox.net X-Patchwork-Id: 164008 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 6A726B6FB6 for ; Mon, 11 Jun 2012 05:19:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751645Ab2FJTTw (ORCPT ); Sun, 10 Jun 2012 15:19:52 -0400 Received: from www62.your-server.de ([213.133.104.62]:34588 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750898Ab2FJTTv (ORCPT ); Sun, 10 Jun 2012 15:19:51 -0400 X-Greylist: delayed 1212 seconds by postgrey-1.27 at vger.kernel.org; Sun, 10 Jun 2012 15:19:51 EDT Received: from [78.46.5.204] (helo=sslproxy02.your-server.de) by www62.your-server.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.74) (envelope-from ) id 1SdnMN-0003Go-Kd; Sun, 10 Jun 2012 20:59:35 +0200 Received: from [109.246.197.199] by sslproxy02.your-server.de with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1SdnML-0008OT-Ta; Sun, 10 Jun 2012 20:59:33 +0200 Message-ID: <4FD4EE90.1070302@iogearbox.net> Date: Sun, 10 Jun 2012 20:59:28 +0200 From: Daniel Borkmann User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20111110 Icedove/3.0.11 MIME-Version: 1.0 To: "David S. Miller" CC: "netdev@vger.kernel.org" Subject: [PATCH] af_packet: use sizeof instead of constant in spkt_device X-Authenticated-Sender: danborkmann@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.97.3/15024/Sun Jun 10 00:29:59 2012) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: 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 --- net/packet/af_packet.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);