All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] netlink: simplify NLMSG_DATA with NLMSG_HDRLEN
@ 2021-06-07  1:44 Chen Li
  2021-06-10 20:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 4+ messages in thread
From: Chen Li @ 2021-06-07  1:44 UTC (permalink / raw)
  To: Jakub Kicinski, netdev

The NLMSG_LENGTH(0) may confuse the API users,
NLMSG_HDRLEN is much more clear.

Besides, some code style problems are also fixed.
Signed-off-by: Chen Li <chenli@uniontech.com>
---
 include/uapi/linux/netlink.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h
index 3d94269bbfa8..4c0cde075c27 100644
--- a/include/uapi/linux/netlink.h
+++ b/include/uapi/linux/netlink.h
@@ -91,9 +91,10 @@ struct nlmsghdr {
 #define NLMSG_HDRLEN	 ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
 #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_DATA(nlh)  ((void *)(((char *)nlh) + NLMSG_HDRLEN))
 #define NLMSG_NEXT(nlh,len)	 ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
-				  (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
+				  (struct nlmsghdr *)(((char *)(nlh)) + \
+				  NLMSG_ALIGN((nlh)->nlmsg_len)))
 #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
 			   (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
 			   (nlh)->nlmsg_len <= (len))
-- 
2.31.1








^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] netlink: simplify NLMSG_DATA with NLMSG_HDRLEN
  2021-06-07  1:44 [PATCH] netlink: simplify NLMSG_DATA with NLMSG_HDRLEN Chen Li
@ 2021-06-10 20:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-10 20:40 UTC (permalink / raw)
  To: Chen Li; +Cc: kuba, netdev

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Mon, 07 Jun 2021 09:44:35 +0800 you wrote:
> The NLMSG_LENGTH(0) may confuse the API users,
> NLMSG_HDRLEN is much more clear.
> 
> Besides, some code style problems are also fixed.
> Signed-off-by: Chen Li <chenli@uniontech.com>
> ---
>  include/uapi/linux/netlink.h | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Here is the summary with links:
  - netlink: simplify NLMSG_DATA with NLMSG_HDRLEN
    https://git.kernel.org/netdev/net-next/c/d409989b59ad

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] netlink: simplify NLMSG_DATA with NLMSG_HDRLEN
  2021-05-27 16:07 ` Jakub Kicinski
@ 2021-05-28  1:20   ` Chen Li
  0 siblings, 0 replies; 4+ messages in thread
From: Chen Li @ 2021-05-28  1:20 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: linux-kernel, David S. Miller

On Fri, 28 May 2021 00:07:24 +0800,
Jakub Kicinski wrote:
> 
> On Thu, 27 May 2021 15:21:36 +0800 Chen Li wrote:
> > The NLMSG_LENGTH(0) may confuse the API users,
> > NLMSG_HDRLEN is much more clear.
> > 
> > Besides, some code style problems are also fixed.
> > Signed-off-by: Chen Li <chenli@uniontech.com>
> 
> Looks fine, but you'll need to repost and CC netdev@vger.
> 
> 

Thanks, done.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] netlink: simplify NLMSG_DATA with NLMSG_HDRLEN
       [not found] <878s401w1r.wl-chenli@uniontech.com>
@ 2021-05-27 16:07 ` Jakub Kicinski
  2021-05-28  1:20   ` Chen Li
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2021-05-27 16:07 UTC (permalink / raw)
  To: Chen Li; +Cc: linux-kernel, David S. Miller

On Thu, 27 May 2021 15:21:36 +0800 Chen Li wrote:
> The NLMSG_LENGTH(0) may confuse the API users,
> NLMSG_HDRLEN is much more clear.
> 
> Besides, some code style problems are also fixed.
> Signed-off-by: Chen Li <chenli@uniontech.com>

Looks fine, but you'll need to repost and CC netdev@vger.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-10 20:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07  1:44 [PATCH] netlink: simplify NLMSG_DATA with NLMSG_HDRLEN Chen Li
2021-06-10 20:40 ` patchwork-bot+netdevbpf
     [not found] <878s401w1r.wl-chenli@uniontech.com>
2021-05-27 16:07 ` Jakub Kicinski
2021-05-28  1:20   ` Chen Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.