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; -- 2.4.2