Skip to content

Commit

Permalink
selftests: nci: Fix the wrong condition
Browse files Browse the repository at this point in the history
memcpy should be executed only in case nla_len's value is greater than 0.

Signed-off-by: Bongsu Jeon <bongsu.jeon@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Bongsu Jeon authored and David S. Miller committed Aug 18, 2021
1 parent 78a7b2a commit 1d5b8d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/selftests/nci/nci_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static int send_cmd_mt_nla(int sd, __u16 nlmsg_type, __u32 nlmsg_pid,
na->nla_type = nla_type[cnt];
na->nla_len = nla_len[cnt] + NLA_HDRLEN;

if (nla_len > 0)
if (nla_len[cnt] > 0)
memcpy(NLA_DATA(na), nla_data[cnt], nla_len[cnt]);

prv_len = NLA_ALIGN(nla_len[cnt]) + NLA_HDRLEN;
Expand Down

0 comments on commit 1d5b8d0

Please sign in to comment.