Skip to content

Conversation

nielsdos
Copy link
Member

@nielsdos nielsdos commented Jan 23, 2023

The current check always evaluated to false because if !page_size is true, then page_size & (page_size - 1) equals 0 & (0 - 1) which is always 0. The if condition is meant to check if page_size is zero or not a power of two, thus we must change the AND to an OR to fix this issue.

Found using static analysis, and manually verified.

The current check always evaluated to false because if `!page_size`
is true, then `page_size & (page_size - 1)` equals `0 & (0 - 1)` which
is always 0. The if condition is meant to check if page_size is zero or
not a power of two, thus we must change the AND to an OR to fix this
issue.
@Girgias Girgias self-assigned this Jan 24, 2023
@Girgias Girgias closed this in b7a158a Jan 25, 2023
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