Skip to content

Commit 480d744

Browse files
committed
opal_datatype_copy: fix argument test
The copy_type tests had what looked like a copy-and-paste error of testing the arguments. This was found by gcc 14's static analyzer. Signed-off-by: Jeff Squyres <[email protected]>
1 parent 39a8583 commit 480d744

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

opal/datatype/opal_datatype_copy.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
1919
* Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved.
20+
* Copyright (c) 2024 Jeffrey M. Squyres. All rights reserved.
2021
* $COPYRIGHT$
2122
*
2223
* Additional copyrights may follow
@@ -76,7 +77,7 @@ static void *opal_datatype_accelerator_memcpy(void *dest, const void *src, size_
7677
else if (0 >= dst_type && 0 < src_type) {
7778
copy_type = MCA_ACCELERATOR_TRANSFER_DTOH;
7879
}
79-
else if (0 < dst_type && 0 >= dst_type) {
80+
else if (0 < dst_type && 0 >= src_type) {
8081
copy_type = MCA_ACCELERATOR_TRANSFER_HTOD;
8182
}
8283
res = opal_accelerator.mem_copy(dst_dev, src_dev,
@@ -109,7 +110,7 @@ static void *opal_datatype_accelerator_memmove(void *dest, const void *src, size
109110
else if (0 >= dst_type && 0 < src_type) {
110111
copy_type = MCA_ACCELERATOR_TRANSFER_DTOH;
111112
}
112-
else if (0 < dst_type && 0 >= dst_type) {
113+
else if (0 < dst_type && 0 >= src_type) {
113114
copy_type = MCA_ACCELERATOR_TRANSFER_HTOD;
114115
}
115116
res = opal_accelerator.mem_move(dst_dev, src_dev,

0 commit comments

Comments
 (0)