Skip to content

Commit

Permalink
aws: Properly initialize optlen for getopt() call
Browse files Browse the repository at this point in the history
The optlen argument for fi_getopt() should be initialized to the length
of the optval datatype.  The EFA provider does not currently enforce
this check, but will do so in the future (as it's a bug in the provider
that they do not currently check the length before writing).

Signed-off-by: Brian Barrett <[email protected]>
(cherry picked from commit 69d6320)
  • Loading branch information
bwbarrett committed Aug 24, 2023
1 parent a7949c6 commit a75b176
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/platform-aws.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ static ncclResult_t validate_rdma_write(struct fid_ep *ep)
int ret = ncclSuccess;
#if HAVE_DECL_FI_OPT_EFA_EMULATED_WRITE
bool optval;
size_t optlen = 0;
size_t optlen = sizeof(optval);

ret = fi_getopt(&ep->fid, FI_OPT_ENDPOINT, FI_OPT_EFA_EMULATED_WRITE, &optval, &optlen);
if(ret != 0 || optlen != sizeof(bool)) {
if(ret != 0 || optlen != sizeof(optval)) {
NCCL_OFI_WARN("Couldn't get FI_OPT_EFA_EMULATED_WRITE. optlen: %lu, RC: %d, ERROR: %s",
optlen, ret, fi_strerror(-ret));
ret = ncclSystemError;
Expand Down

0 comments on commit a75b176

Please sign in to comment.