aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorOlaf Hering <olaf@aepfle.de>2013-08-07 09:45:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-12 18:44:57 -0400
commitb4fb0ca26055bb39b18a1427eea633877a3dcc80 (patch)
treea47b6bb598c0ea5bbc1265f35e07c2bae5d6556a /tools
parent2bc41ea3b3fd4c2f2473ec84f4ee3ef5ff21e49b (diff)
Tools: hv: use full nlmsghdr in netlink_send
There is no need to have a nlmsghdr pointer to another temporary buffer. Instead use a full struct nlmsghdr. Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/hv/hv_kvp_daemon.c15
-rw-r--r--tools/hv/hv_vss_daemon.c15
2 files changed, 10 insertions, 20 deletions
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index dca06a26ee2a..8fd9ec66121c 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -1392,23 +1392,18 @@ kvp_get_domain_name(char *buffer, int length)
1392static int 1392static int
1393netlink_send(int fd, struct cn_msg *msg) 1393netlink_send(int fd, struct cn_msg *msg)
1394{ 1394{
1395 struct nlmsghdr *nlh; 1395 struct nlmsghdr nlh = { .nlmsg_type = NLMSG_DONE };
1396 unsigned int size; 1396 unsigned int size;
1397 struct msghdr message; 1397 struct msghdr message;
1398 char buffer[64];
1399 struct iovec iov[2]; 1398 struct iovec iov[2];
1400 1399
1401 size = sizeof(struct cn_msg) + msg->len; 1400 size = sizeof(struct cn_msg) + msg->len;
1402 1401
1403 nlh = (struct nlmsghdr *)buffer; 1402 nlh.nlmsg_pid = getpid();
1404 nlh->nlmsg_seq = 0; 1403 nlh.nlmsg_len = NLMSG_LENGTH(size);
1405 nlh->nlmsg_pid = getpid();
1406 nlh->nlmsg_type = NLMSG_DONE;
1407 nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh));
1408 nlh->nlmsg_flags = 0;
1409 1404
1410 iov[0].iov_base = nlh; 1405 iov[0].iov_base = &nlh;
1411 iov[0].iov_len = sizeof(*nlh); 1406 iov[0].iov_len = sizeof(nlh);
1412 1407
1413 iov[1].iov_base = msg; 1408 iov[1].iov_base = msg;
1414 iov[1].iov_len = size; 1409 iov[1].iov_len = size;
diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c
index 7cd2544aa49b..8611962c672c 100644
--- a/tools/hv/hv_vss_daemon.c
+++ b/tools/hv/hv_vss_daemon.c
@@ -105,23 +105,18 @@ static int vss_operate(int operation)
105 105
106static int netlink_send(int fd, struct cn_msg *msg) 106static int netlink_send(int fd, struct cn_msg *msg)
107{ 107{
108 struct nlmsghdr *nlh; 108 struct nlmsghdr nlh = { .nlmsg_type = NLMSG_DONE };
109 unsigned int size; 109 unsigned int size;
110 struct msghdr message; 110 struct msghdr message;
111 char buffer[64];
112 struct iovec iov[2]; 111 struct iovec iov[2];
113 112
114 size = sizeof(struct cn_msg) + msg->len; 113 size = sizeof(struct cn_msg) + msg->len;
115 114
116 nlh = (struct nlmsghdr *)buffer; 115 nlh.nlmsg_pid = getpid();
117 nlh->nlmsg_seq = 0; 116 nlh.nlmsg_len = NLMSG_LENGTH(size);
118 nlh->nlmsg_pid = getpid();
119 nlh->nlmsg_type = NLMSG_DONE;
120 nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh));
121 nlh->nlmsg_flags = 0;
122 117
123 iov[0].iov_base = nlh; 118 iov[0].iov_base = &nlh;
124 iov[0].iov_len = sizeof(*nlh); 119 iov[0].iov_len = sizeof(nlh);
125 120
126 iov[1].iov_base = msg; 121 iov[1].iov_base = msg;
127 iov[1].iov_len = size; 122 iov[1].iov_len = size;