Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4fb0ca2 authored by Olaf Hering's avatar Olaf Hering Committed by Greg Kroah-Hartman
Browse files

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: default avatarOlaf Hering <olaf@aepfle.de>
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2bc41ea3
Loading
Loading
Loading
Loading
+5 −10
Original line number Original line Diff line number Diff line
@@ -1392,23 +1392,18 @@ kvp_get_domain_name(char *buffer, int length)
static int
static int
netlink_send(int fd, struct cn_msg *msg)
netlink_send(int fd, struct cn_msg *msg)
{
{
	struct nlmsghdr *nlh;
	struct nlmsghdr nlh = { .nlmsg_type = NLMSG_DONE };
	unsigned int size;
	unsigned int size;
	struct msghdr message;
	struct msghdr message;
	char buffer[64];
	struct iovec iov[2];
	struct iovec iov[2];


	size = sizeof(struct cn_msg) + msg->len;
	size = sizeof(struct cn_msg) + msg->len;


	nlh = (struct nlmsghdr *)buffer;
	nlh.nlmsg_pid = getpid();
	nlh->nlmsg_seq = 0;
	nlh.nlmsg_len = NLMSG_LENGTH(size);
	nlh->nlmsg_pid = getpid();
	nlh->nlmsg_type = NLMSG_DONE;
	nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh));
	nlh->nlmsg_flags = 0;


	iov[0].iov_base = nlh;
	iov[0].iov_base = &nlh;
	iov[0].iov_len = sizeof(*nlh);
	iov[0].iov_len = sizeof(nlh);


	iov[1].iov_base = msg;
	iov[1].iov_base = msg;
	iov[1].iov_len = size;
	iov[1].iov_len = size;
+5 −10
Original line number Original line Diff line number Diff line
@@ -105,23 +105,18 @@ static int vss_operate(int operation)


static int netlink_send(int fd, struct cn_msg *msg)
static int netlink_send(int fd, struct cn_msg *msg)
{
{
	struct nlmsghdr *nlh;
	struct nlmsghdr nlh = { .nlmsg_type = NLMSG_DONE };
	unsigned int size;
	unsigned int size;
	struct msghdr message;
	struct msghdr message;
	char buffer[64];
	struct iovec iov[2];
	struct iovec iov[2];


	size = sizeof(struct cn_msg) + msg->len;
	size = sizeof(struct cn_msg) + msg->len;


	nlh = (struct nlmsghdr *)buffer;
	nlh.nlmsg_pid = getpid();
	nlh->nlmsg_seq = 0;
	nlh.nlmsg_len = NLMSG_LENGTH(size);
	nlh->nlmsg_pid = getpid();
	nlh->nlmsg_type = NLMSG_DONE;
	nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh));
	nlh->nlmsg_flags = 0;


	iov[0].iov_base = nlh;
	iov[0].iov_base = &nlh;
	iov[0].iov_len = sizeof(*nlh);
	iov[0].iov_len = sizeof(nlh);


	iov[1].iov_base = msg;
	iov[1].iov_base = msg;
	iov[1].iov_len = size;
	iov[1].iov_len = size;