netlink: remove duplicated NLMSG_ALIGN
Subsystems (2)
PATCH 1/1 netlink: remove duplicated NLMSG_ALIGN
NLMSG_HDRLEN is already aligned value. It's for directly reference without extra alignment.
The redundant alignment here may confuse the API users.
--- include/uapi/linux/netlink.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/netlink.h +1 -1
@@ -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), \
Signature · 1 line
1.7.10.4
Quoted 6 lines · Hong Zhiguo
NLMSG_HDRLENis 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 <[email protected]>
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>
From: Thomas Graf <[email protected]>
Date: Tue, 26 Mar 2013 11:13:47 +0000
Quoted 9 lines · Hong Zhiguo
Quoted 6 lines
NLMSG_HDRLENis 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 <[email protected]>Acked-by Thomas Graf <[email protected]>
Applied, thanks.