[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1461144802.10638.249.camel@edumazet-glaptop3.roam.corp.google.com>
Date: Wed, 20 Apr 2016 02:33:22 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Nicolas Dichtel <nicolas.dichtel@...nd.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net,
roopa@...ulusnetworks.com, tgraf@...g.ch, jhs@...atatu.com
Subject: Re: [PATCH net-next 1/4] netlink: fix test alignment in
nla_align_64bit()
On Wed, 2016-04-20 at 10:57 +0200, Nicolas Dichtel wrote:
> IS_ALIGN() returns true when the alignment is as expected. The pad
> attribute should be added only when the alignment is not 8.
>
> Fixes: 35c5845957c7 ("net: Add helpers for 64-bit aligning netlink attributes.")
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@...nd.com>
> ---
> include/net/netlink.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/net/netlink.h b/include/net/netlink.h
> index e644b3489acf..694caac31d2c 100644
> --- a/include/net/netlink.h
> +++ b/include/net/netlink.h
> @@ -1245,7 +1245,7 @@ static inline int nla_validate_nested(const struct nlattr *start, int maxtype,
> static inline int nla_align_64bit(struct sk_buff *skb, int padattr)
> {
> #ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS
> - if (IS_ALIGNED((unsigned long)skb->data, 8)) {
> + if (!IS_ALIGNED((unsigned long)skb->data, 8)) {
> struct nlattr *attr = nla_reserve(skb, padattr, 0);
> if (!attr)
> return -EMSGSIZE;
This is silly.
How have you tested your patch exactly ?
I guess David should have copied his original comment here.
- * The nlattr header is 4 bytes in size, that's why we test
- * if the skb->data _is_ aligned. This NOP attribute, plus
- * nlattr header for IFLA_STATS64, will make nla_data() 8-byte
- * aligned.
Powered by blists - more mailing lists