Skip to content

Commit e89ef82

Browse files
authored
Merge pull request #11259 from roiedanino/bugfix/#11257_mca_atomic_ucx_cswap-Stack-Smashing
bugfix/#11257 mca_atomic_ucx_cswap-Stack-Smashing
2 parents 38441ef + ae52971 commit e89ef82

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

oshmem/mca/atomic/ucx/atomic_ucx_cswap.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,17 @@ int mca_atomic_ucx_cswap(shmem_ctx_t ctx,
3939
.reply_buffer = prev
4040
};
4141
#endif
42+
assert(NULL != prev);
4243

43-
if ((8 != size) && (4 != size)) {
44+
if (size == 8) {
45+
*prev = value;
46+
} else if (size == 4) {
47+
*(uint32_t*)prev = value;
48+
} else {
4449
ATOMIC_ERROR("[#%d] Type size must be 4 or 8 bytes.", my_pe);
4550
return OSHMEM_ERROR;
4651
}
4752

48-
assert(NULL != prev);
49-
50-
*prev = value;
5153
ucx_mkey = mca_spml_ucx_ctx_mkey_by_va(ctx, pe, target, (void *)&rva, mca_spml_self);
5254
assert(NULL != ucx_mkey);
5355
#if HAVE_DECL_UCP_ATOMIC_OP_NBX

0 commit comments

Comments
 (0)