Skip to content

Commit

Permalink
selftests: nci: Fix the code for next nlattr offset
Browse files Browse the repository at this point in the history
[ Upstream commit 78a7b2a ]

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>
  • Loading branch information
Bongsu Jeon authored and gregkh committed Sep 18, 2021
1 parent 0a33324 commit e0921e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/nci/nci_dev.c
Expand Up @@ -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;
Expand Down

0 comments on commit e0921e7

Please sign in to comment.