Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754503AbcDVQv0 (ORCPT ); Fri, 22 Apr 2016 12:51:26 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:33691 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753878AbcDVQvY (ORCPT ); Fri, 22 Apr 2016 12:51:24 -0400 Message-ID: <1461343880.7627.34.camel@edumazet-glaptop3.roam.corp.google.com> Subject: Re: [PATCH net-next 2/9] libnl: nla_put_le64(): align on a 64-bit area From: Eric Dumazet To: Nicolas Dichtel Cc: netdev@vger.kernel.org, davem@davemloft.net, linux-kernel@vger.kernel.org, linux-wpan@vger.kernel.org, aar@pengutronix.de, pablo@netfilter.org, kaber@trash.net, kadlec@blackhole.kfki.hu, pshelar@nicira.com, kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org, netfilter-devel@vger.kernel.org, dev@openvswitch.org, steffen.klassert@secunet.com, herbert@gondor.apana.org.au, bsingharora@gmail.com Date: Fri, 22 Apr 2016 09:51:20 -0700 In-Reply-To: <1461339084-3849-3-git-send-email-nicolas.dichtel@6wind.com> References: <1461339084-3849-1-git-send-email-nicolas.dichtel@6wind.com> <1461339084-3849-3-git-send-email-nicolas.dichtel@6wind.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1425 Lines: 41 On Fri, 2016-04-22 at 17:31 +0200, Nicolas Dichtel wrote: > nla_data() is now aligned on a 64-bit area. > > Signed-off-by: Nicolas Dichtel > --- > include/net/netlink.h | 8 +++++--- > include/net/nl802154.h | 6 ++++++ > net/ieee802154/nl802154.c | 13 ++++++++----- > 3 files changed, 19 insertions(+), 8 deletions(-) > > diff --git a/include/net/netlink.h b/include/net/netlink.h > index 6f51a8a06498..7f6b99483ab7 100644 > --- a/include/net/netlink.h > +++ b/include/net/netlink.h > @@ -878,14 +878,16 @@ static inline int nla_put_net64(struct sk_buff *skb, int attrtype, __be64 value) > } > > /** > - * nla_put_le64 - Add a __le64 netlink attribute to a socket buffer > + * nla_put_le64 - Add a __le64 netlink attribute to a socket buffer and align it > * @skb: socket buffer to add attribute to > * @attrtype: attribute type > * @value: numeric value > + * @padattr: attribute type for the padding > */ > -static inline int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value) > +static inline int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value, > + int padattr) > { > - return nla_put(skb, attrtype, sizeof(__le64), &value); > + return nla_put_64bit(skb, attrtype, sizeof(__le64), &value, padattr); > } > But _why_ is it needed ? nla_put() has no alignment assumptions, it simply copies 8 bytes. Seems this is going too far.