From: Mathias Krause <minipli@googlemail.com>
To: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Mathias Krause <minipli@googlemail.com>, netdev@vger.kernel.org
Subject: [PATCH 4/4] connector - documentation: simplify netlink message length assignment
Date: Mon, 30 Sep 2013 22:03:09 +0200 [thread overview]
Message-ID: <1380571389-15343-5-git-send-email-minipli@googlemail.com> (raw)
In-Reply-To: <1380571389-15343-1-git-send-email-minipli@googlemail.com>
Use the precalculated size instead of obfuscating the message length
calculation by first subtracting the netlink header length from size
and then use the NLMSG_LENGTH() macro to add it back again.
Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
Documentation/connector/ucon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/connector/ucon.c b/Documentation/connector/ucon.c
index 4848db8..8a4da64 100644
--- a/Documentation/connector/ucon.c
+++ b/Documentation/connector/ucon.c
@@ -71,7 +71,7 @@ static int netlink_send(int s, struct cn_msg *msg)
nlh->nlmsg_seq = seq++;
nlh->nlmsg_pid = getpid();
nlh->nlmsg_type = NLMSG_DONE;
- nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh));
+ nlh->nlmsg_len = size;
nlh->nlmsg_flags = 0;
m = NLMSG_DATA(nlh);
--
1.7.10.4
next prev parent reply other threads:[~2013-09-30 20:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-30 20:03 [PATCH 0/4] connector fixes Mathias Krause
2013-09-30 20:03 ` [PATCH 1/4] proc connector: fix info leaks Mathias Krause
2013-09-30 20:03 ` [PATCH 2/4] connector: use nlmsg_len() to check message length Mathias Krause
2013-09-30 20:03 ` [PATCH 3/4] connector: use 'size' everywhere in cn_netlink_send() Mathias Krause
2013-09-30 20:03 ` Mathias Krause [this message]
2013-10-02 20:04 ` [PATCH 0/4] connector fixes David Miller
2013-10-06 20:46 ` Рустафа Джамурахметов
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1380571389-15343-5-git-send-email-minipli@googlemail.com \
--to=minipli@googlemail.com \
--cc=netdev@vger.kernel.org \
--cc=zbr@ioremap.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox