From patchwork Sun Mar 28 00:11:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Engelhardt X-Patchwork-Id: 48764 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 A442BB7CF9 for ; Sun, 28 Mar 2010 11:11:30 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754283Ab0C1ALQ (ORCPT ); Sat, 27 Mar 2010 20:11:16 -0400 Received: from borg.medozas.de ([188.40.89.202]:58846 "EHLO borg.medozas.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754027Ab0C1ALP (ORCPT ); Sat, 27 Mar 2010 20:11:15 -0400 Received: by borg.medozas.de (Postfix, from userid 25121) id B6B58F0C32BEA; Sun, 28 Mar 2010 01:11:13 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by borg.medozas.de (Postfix) with ESMTP id AA0931BE2; Sun, 28 Mar 2010 01:11:13 +0100 (CET) Date: Sun, 28 Mar 2010 01:11:13 +0100 (CET) From: Jan Engelhardt To: David Miller cc: schwab@linux-m68k.org, tony.luck@intel.com, netdev@vger.kernel.org Subject: Re: Seeing new kernel unaligned access messages in linux-next on ia64 In-Reply-To: <20100327.163730.179928738.davem@davemloft.net> Message-ID: References: <20100324.203249.97351120.davem@davemloft.net> <20100327.163730.179928738.davem@davemloft.net> User-Agent: Alpine 2.01 (LSU 1266 2009-07-14) MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sunday 2010-03-28 00:37, David Miller wrote: > >> net: fix unaligned access in IFLA_STATS64 > >Applied to net-next-2.6, thanks Jan. > >Hey, don't we need some adjustments to if_nlmsg_size()? I don't see >it accounting for IFLA_STATS64/"struct rtnl_link_stats64" there. If I am not mistaken, the answer is "not strictly". But of course it's nicer if we don't need to realloc just because we were too conservative in the initial calculation. git://dev.medozas.de/linux net parent c5c57d7c7837858aa499610a3ee760b39f1de937 (v2.6.34-rc1-1276-gc5c57d7) commit 305876b7c1c720db30239d08d56b3a058d56aa21 Author: Jan Engelhardt Date: Sun Mar 28 01:03:32 2010 +0100 net: increase preallocated size of nlmsg to accomodate for IFLA_STATS64 When more data is stuffed into an nlmsg than initially projected, an extra allocation needs to be done. Reserve enough for IFLA_STATS64 so that this does not to needlessy happen. Signed-off-by: Jan Engelhardt --- net/core/rtnetlink.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index ed0766f..bf919b6 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -653,6 +653,7 @@ static inline size_t if_nlmsg_size(const struct net_device *dev) + nla_total_size(IFNAMSIZ) /* IFLA_QDISC */ + nla_total_size(sizeof(struct rtnl_link_ifmap)) + nla_total_size(sizeof(struct rtnl_link_stats)) + + nla_total_size(sizeof(struct rtnl_link_stats64)) + nla_total_size(MAX_ADDR_LEN) /* IFLA_ADDRESS */ + nla_total_size(MAX_ADDR_LEN) /* IFLA_BROADCAST */ + nla_total_size(4) /* IFLA_TXQLEN */