Skip to content

Bugfix in pmix_bitmap_num_set_bits#3670

Merged
rhc54 merged 1 commit intoopenpmix:masterfrom
Matthew-Whitlock:master
Aug 26, 2025
Merged

Bugfix in pmix_bitmap_num_set_bits#3670
rhc54 merged 1 commit intoopenpmix:masterfrom
Matthew-Whitlock:master

Conversation

@Matthew-Whitlock
Copy link
Contributor

Before, this would read OOB memory and give confusing results.

Signed-off-by: Matthew Whitlock <mwhitlo@sandia.gov>
@rhc54
Copy link
Contributor

rhc54 commented Aug 26, 2025

Nice catch - thanks!

@rhc54 rhc54 merged commit 47b6634 into openpmix:master Aug 26, 2025
26 checks passed
jsquyres added a commit to jsquyres/ompi that referenced this pull request Dec 27, 2025
Inspired by some fixes in PMIx:

* @Matthew-Witlock's fix in
  openpmix/openpmix@47b6634
  (openpmix/openpmix#3670)
* @Matthew-Witlock's fix in
  openpmix/openpmix@08c22de
  (openpmix/openpmix#3709)
* @Matthew-Witlock's fix in
  openpmix/openpmix@36df200
  (openpmix/openpmix#3732)

Fix some logic errors in opal_bitmap.c:opal_num_set_bits(): the
parameter is supposed to be the number of bits, not number of
elements.  The fixes here are essentially the same as Matthew's, but
with some stylistic changes.

It doesn't look like this function is invoked anywhere in the code
base, which is why we hadn't previously noticed these issues.

That being said, if we have the code, it should be correct.  This
commit therefore also adds some tests for the
opal_bitmap_num_set_bits() function to "make check" to make sure that
it's actually working properly.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
jsquyres added a commit to jsquyres/ompi that referenced this pull request Dec 27, 2025
Inspired by some fixes in PMIx:

* From the @Matthew-Whitlock fix in
  openpmix/openpmix@47b6634
  (openpmix/openpmix#3670)
* From the @Matthew-Whitlock fix in
  openpmix/openpmix@08c22de
  (openpmix/openpmix#3709)
* From the @Matthew-Whitlock fix in
  openpmix/openpmix@36df200
  (openpmix/openpmix#3732)

Fix some logic errors in opal_bitmap.c:opal_num_set_bits(): the
parameter is supposed to be the number of bits, not number of
elements.  The fixes here are essentially the same as Matthew's, but
with some stylistic changes.

It doesn't look like this function is invoked anywhere in the code
base, which is why we hadn't previously noticed these issues.

That being said, if we have the code, it should be correct.  This
commit therefore also adds some tests for the
opal_bitmap_num_set_bits() function to "make check" to make sure that
it's actually working properly.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
jsquyres added a commit to jsquyres/ompi that referenced this pull request Dec 27, 2025
Inspired by some fixes in PMIx:

* From the @Matthew-Whitlock fix in
  openpmix/openpmix@47b6634
  (openpmix/openpmix#3670)
* From the @Matthew-Whitlock fix in
  openpmix/openpmix@08c22de
  (openpmix/openpmix#3709)
* From the @Matthew-Whitlock fix in
  openpmix/openpmix@36df200
  (openpmix/openpmix#3732)

Fix some logic errors in opal_bitmap.c:opal_num_set_bits(): the
parameter is supposed to be the number of bits, not number of
elements.  The fixes here are essentially the same as Matthew's, but
with some stylistic changes.

It doesn't look like this function is invoked anywhere in the code
base, which is why we hadn't previously noticed these issues.

That being said, if we have the code, it should be correct.  This
commit therefore also adds some tests for the
opal_bitmap_num_set_bits() function to "make check" to make sure that
it's actually working properly.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
jsquyres added a commit to jsquyres/ompi that referenced this pull request Dec 31, 2025
Inspired by some fixes in PMIx:

* From the @Matthew-Whitlock fix in
  openpmix/openpmix@47b6634
  (openpmix/openpmix#3670)
* From the @Matthew-Whitlock fix in
  openpmix/openpmix@08c22de
  (openpmix/openpmix#3709)
* From the @Matthew-Whitlock fix in
  openpmix/openpmix@36df200
  (openpmix/openpmix#3732)

Fix some logic errors in opal_bitmap.c:opal_num_set_bits(): the
parameter is supposed to be the number of bits, not number of
elements.  The fixes here are essentially the same as Matthew's, but
with some stylistic changes.

It doesn't look like this function is invoked anywhere in the code
base, which is why we hadn't previously noticed these issues.

That being said, if we have the code, it should be correct.  This
commit therefore also adds some tests for the
opal_bitmap_num_set_bits() function to "make check" to make sure that
it's actually working properly.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
(cherry picked from commit 7bbdb0a)
jsquyres added a commit to jsquyres/ompi that referenced this pull request Dec 31, 2025
Inspired by some fixes in PMIx:

* From the @Matthew-Whitlock fix in
  openpmix/openpmix@47b6634
  (openpmix/openpmix#3670)
* From the @Matthew-Whitlock fix in
  openpmix/openpmix@08c22de
  (openpmix/openpmix#3709)
* From the @Matthew-Whitlock fix in
  openpmix/openpmix@36df200
  (openpmix/openpmix#3732)

Fix some logic errors in opal_bitmap.c:opal_num_set_bits(): the
parameter is supposed to be the number of bits, not number of
elements.  The fixes here are essentially the same as Matthew's, but
with some stylistic changes.

It doesn't look like this function is invoked anywhere in the code
base, which is why we hadn't previously noticed these issues.

That being said, if we have the code, it should be correct.  This
commit therefore also adds some tests for the
opal_bitmap_num_set_bits() function to "make check" to make sure that
it's actually working properly.

Signed-off-by: Jeff Squyres <jeff@squyres.com>
(cherry picked from commit 7bbdb0a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants