summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/nci
diff options
context:
space:
mode:
authorBongsu Jeon <bongsu.jeon@samsung.com>2021-08-17 16:28:15 +0300
committerDavid S. Miller <davem@davemloft.net>2021-08-18 12:17:57 +0300
commit1d5b8d01db98abb8c176838fad73287366874582 (patch)
tree83a9572ac9ae6ef9ef93df668c9f5707047f1b27 /tools/testing/selftests/nci
parent78a7b2a8a0fa31f63ac16ac13601db6ed8259dfc (diff)
downloadlinux-1d5b8d01db98abb8c176838fad73287366874582.tar.xz
selftests: nci: Fix the wrong condition
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>
Diffstat (limited to 'tools/testing/selftests/nci')
-rw-r--r--tools/testing/selftests/nci/nci_dev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/nci/nci_dev.c b/tools/testing/selftests/nci/nci_dev.c
index cf47505a6b35..a1786cef73bc 100644
--- a/tools/testing/selftests/nci/nci_dev.c
+++ b/tools/testing/selftests/nci/nci_dev.c
@@ -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;