Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1385687
| From | Alexander Aring <aar@pengutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH net-next 2/9] libnl: nla_put_le64(): align on a 64-bit area |
| Date | 2016-04-23 19:10 +0200 |
| Message-ID | <rr9ea-6Ge-7@gated-at.bofh.it> (permalink) |
| References | <rqLvc-49a-5@gated-at.bofh.it> <rqLvd-49a-37@gated-at.bofh.it> <rqMAW-542-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi,
On 04/22/2016 06:51 PM, Eric Dumazet wrote:
> 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 <nicolas.dichtel@6wind.com>
>> ---
>> 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.
>
if this is really needed, then nla_put_u64/be64/etc need to be changed also,
or? The function nla_put_u64 is the same like nla_put_le64 but with __le64
type, so sparse will not complain about that.
- Alex
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH net-next 0/9] netlink: align attributes when needed (patchset #1) Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-22 17:50 +0200
[PATCH net-next 3/9] libnl: nla_put_be64(): align on a 64-bit area Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-22 17:50 +0200
[PATCH net-next 7/9] libnl: add nla_put_u64_64bit() helper Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-22 17:50 +0200
[PATCH net-next 1/9] libnl: fix help of _64bit functions Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-22 17:50 +0200
[PATCH net-next 2/9] libnl: nla_put_le64(): align on a 64-bit area Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-22 17:50 +0200
Re: [PATCH net-next 2/9] libnl: nla_put_le64(): align on a 64-bit area Eric Dumazet <eric.dumazet@gmail.com> - 2016-04-22 19:00 +0200
Re: [PATCH net-next 2/9] libnl: nla_put_le64(): align on a 64-bit area Alexander Aring <aar@pengutronix.de> - 2016-04-23 19:10 +0200
Re: [PATCH net-next 2/9] libnl: nla_put_le64(): align on a 64-bit area Alexander Aring <aar@pengutronix.de> - 2016-04-23 19:30 +0200
Re: [PATCH net-next 2/9] libnl: nla_put_le64(): align on a 64-bit area Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-25 09:50 +0200
[PATCH net-next 6/9] libnl: nla_put_msecs(): align on a 64-bit area Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-22 17:50 +0200
[PATCH net-next 8/9] xfrm: align nlattr properly when needed Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-22 17:50 +0200
[PATCH net-next 5/9] libnl: nla_put_s64(): align on a 64-bit area Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-22 17:50 +0200
[PATCH net-next 4/9] libnl: nla_put_net64(): align on a 64-bit area Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-22 17:50 +0200
[PATCH net-next 9/9] taskstats: use the libnl API to align nlattr on 64-bit Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-22 17:50 +0200
Re: [PATCH net-next 9/9] taskstats: use the libnl API to align nlattr on 64-bit Balbir Singh <bsingharora@gmail.com> - 2016-04-27 03:20 +0200
Re: [PATCH net-next 9/9] taskstats: use the libnl API to align nlattr on 64-bit Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-27 09:30 +0200
Re: [PATCH net-next 9/9] taskstats: use the libnl API to align nlattr on 64-bit Balbir Singh <bsingharora@gmail.com> - 2016-04-27 14:30 +0200
Re: [PATCH net-next 9/9] taskstats: use the libnl API to align nlattr on 64-bit Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-27 17:50 +0200
[PATCH net-next] taskstats: fix nl parsing in accounting/getdelays.c Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-27 17:50 +0200
Re: [PATCH net-next] taskstats: fix nl parsing in accounting/getdelays.c Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-04-27 18:00 +0200
Re: [PATCH net-next 9/9] taskstats: use the libnl API to align nlattr on 64-bit David Miller <davem@davemloft.net> - 2016-04-27 18:50 +0200
Re: [PATCH net-next 0/9] netlink: align attributes when needed (patchset #1) David Miller <davem@davemloft.net> - 2016-04-24 02:20 +0200
csiph-web