From b1ad04788677b4eef928178def9bd57f04559ffd Mon Sep 17 00:00:00 2001 From: Omri Mor Date: Thu, 25 Jan 2024 13:39:24 -0800 Subject: [PATCH] coll/barrier: fix op undercount and buffer overflow for non-power-of-two --- lci/experimental/coll/barrier.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lci/experimental/coll/barrier.c b/lci/experimental/coll/barrier.c index 0635c96d..c2eb27d6 100644 --- a/lci/experimental/coll/barrier.c +++ b/lci/experimental/coll/barrier.c @@ -20,8 +20,8 @@ LCI_error_t LCIX_barrier(LCI_endpoint_t ep, LCI_tag_t tag, return LCI_OK; } - /* We have at most 2 * ilog2(size) scheduled operations */ - sched_ops = 2 * ilog2(size); + /* We have at most 2 * (1 + ilog2(size)) scheduled operations */ + sched_ops = 2 * (1 + ilog2(size)); LCIX_collective_t coll = LCIU_malloc(sizeof(struct LCIX_collective_s)); LCIXC_mcoll_init(coll, ep, tag, NULL, completion, user_context, empty,