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.dich...@6wind.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.


Reply via email to