Message ID | alpine.LSU.2.01.1003280107420.14977@obet.zrqbmnf.qr |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Jan Engelhardt <jengelh@medozas.de> Date: Sun, 28 Mar 2010 01:11:13 +0100 (CET) > 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. Right. > 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 <jengelh@medozas.de> Applied, thanks a lot! -- 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/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 */