bitmap num_set boundary condition bugfix#3709
Merged
rhc54 merged 1 commit intoopenpmix:masterfrom Oct 27, 2025
Merged
Conversation
Signed-off-by: Matthew Whitlock <mwhitlo@sandia.gov>
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The original
len >= ...debug check should have just beenlen > ..., else this function returns 0 when you have a bitmap of size 64 and count the set bits in the full range.Since
pmix_bitmap_set_bitallows for dynamically growing the bitmap array, it makes sense to me to allow checking the set bits beyond the current array size (treating the unallocated bits as unset).