From: Yu Zhiguo <yuzg@cn.fujitsu.com>
To: Steve Grubb <sgrubb@redhat.com>
Cc: audit-list <linux-audit@redhat.com>
Subject: the method to get nlmsg_len in audit_send() is error
Date: Mon, 28 Jul 2008 17:02:53 +0800 [thread overview]
Message-ID: <488D8B3D.5040405@cn.fujitsu.com> (raw)
Hello Steve,
I think micro NLMSG_ALIGN is needless for nlmsg_len, NLMSG_SPACE is sufficient.
because NLMSG_SPACE includes the rounded netlink header size.
Now no errors occurred because struct req has been set to all 0.
Signed-off-by: Yu Zhiguo<yuzg@cn.fujitsu.com>
---
lib/netlink.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/netlink.c b/lib/netlink.c
index 2f78a96..2e2e6be 100644
--- a/lib/netlink.c
+++ b/lib/netlink.c
@@ -220,7 +220,7 @@ int audit_send(int fd, int type, const void *data, unsigned
int size)
sequence = 1;
memset(&req, 0, sizeof(req));
- req.nlh.nlmsg_len = NLMSG_ALIGN(req.nlh.nlmsg_len) + NLMSG_SPACE(size);
+ req.nlh.nlmsg_len = NLMSG_SPACE(size);
req.nlh.nlmsg_type = type;
req.nlh.nlmsg_flags = NLM_F_REQUEST|NLM_F_ACK;
req.nlh.nlmsg_seq = sequence;
next reply other threads:[~2008-07-28 9:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-28 9:02 Yu Zhiguo [this message]
2008-07-28 16:45 ` the method to get nlmsg_len in audit_send() is error Steve Grubb
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=488D8B3D.5040405@cn.fujitsu.com \
--to=yuzg@cn.fujitsu.com \
--cc=linux-audit@redhat.com \
--cc=sgrubb@redhat.com \
/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