diff mbox

[net-next] netlink: remove duplicated NLMSG_ALIGN

Message ID 1364274245-20689-1-git-send-email-honkiko@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Hong zhi guo March 26, 2013, 5:04 a.m. UTC
NLMSG_HDRLEN is already aligned value. It's for directly reference
without extra alignment.

The redundant alignment here may confuse the API users.

Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
---
 include/uapi/linux/netlink.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Graf March 26, 2013, 11:13 a.m. UTC | #1
On 03/26/13 at 01:04pm, Hong Zhiguo wrote:
> NLMSG_HDRLEN is already aligned value. It's for directly reference
> without extra alignment.
> 
> The redundant alignment here may confuse the API users.
> 
> Signed-off-by: Hong Zhiguo <honkiko@gmail.com>

Acked-by: Thomas Graf <tgraf@suug.ch>

This is actually an obsoleted API that we only want to keep around
for backwards compatibility with user space. It would be great to
replace all in kernel usages of NLMSG_LENGTH() with the type safe
variants nlmsg_*() in <net/netlink.h>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 26, 2013, 4:40 p.m. UTC | #2
From: Thomas Graf <tgraf@suug.ch>
Date: Tue, 26 Mar 2013 11:13:47 +0000

> On 03/26/13 at 01:04pm, Hong Zhiguo wrote:
>> NLMSG_HDRLEN is already aligned value. It's for directly reference
>> without extra alignment.
>> 
>> The redundant alignment here may confuse the API users.
>> 
>> Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
> 
> Acked-by: Thomas Graf <tgraf@suug.ch>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h
index 78d5b8a..32a354f 100644
--- a/include/uapi/linux/netlink.h
+++ b/include/uapi/linux/netlink.h
@@ -78,7 +78,7 @@  struct nlmsghdr {
 #define NLMSG_ALIGNTO	4U
 #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
 #define NLMSG_HDRLEN	 ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
-#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN))
+#define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN)
 #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
 #define NLMSG_DATA(nlh)  ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
 #define NLMSG_NEXT(nlh,len)	 ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \