summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBongsu Jeon <bongsu.jeon@samsung.com>2021-08-17 06:28:14 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-09-18 13:43:52 +0200
commit0fa02e06059ea6c74ff991655589c7c607798798 (patch)
tree4c681ccc0aae0cc6c78ea1505b0b7ffe98b5594f /tools
parent5196716ab948cd3b49638ceb776f530ddf16d945 (diff)
selftests: nci: Fix the code for next nlattr offset
[ Upstream commit 78a7b2a8a0fa31f63ac16ac13601db6ed8259dfc ] nlattr could have a padding for 4 bytes alignment. So next nla's offset should be calculated with a padding. Signed-off-by: Bongsu Jeon <bongsu.jeon@samsung.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/nci/nci_dev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/nci/nci_dev.c b/tools/testing/selftests/nci/nci_dev.c
index 57b505cb1561..9687100f15ea 100644
--- a/tools/testing/selftests/nci/nci_dev.c
+++ b/tools/testing/selftests/nci/nci_dev.c
@@ -113,8 +113,8 @@ static int send_cmd_mt_nla(int sd, __u16 nlmsg_type, __u32 nlmsg_pid,
if (nla_len > 0)
memcpy(NLA_DATA(na), nla_data[cnt], nla_len[cnt]);
- msg.n.nlmsg_len += NLMSG_ALIGN(na->nla_len);
- prv_len = na->nla_len;
+ prv_len = NLA_ALIGN(nla_len[cnt]) + NLA_HDRLEN;
+ msg.n.nlmsg_len += prv_len;
}
buf = (char *)&msg;