-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use non-zero page size #258
Use non-zero page size #258
Conversation
607daa5
to
ffe3eb0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is breaking API and should have a CHANGELOG entry. While I see no problem with the approach, I wonder whether this could be reasoned a bit better in the commit message.
My immediate questions are: Where did this cause major problems? Why is making the user go through the NonZeroUsize conversion worth it?
Is this the only place where we deal with page_sizes? 🤔 Should we convert them all?
I've added more details to the commit message.
Without this it is possible to trigger a divide by zero error, see https://github.com/rust-vmm/vm-memory/blob/main/src/bitmap/backend/atomic_bitmap.rs#L28
Are there other places you see potential errors that you think should be fixed? |
Sure! I was just wondering where that became a problem in "practise" :). |
ffe3eb0
to
4fb8875
Compare
I understand your point, in practice I cannot see this occurring outside very exotic circumstances, but it is possible (as its a public function) so it should be mitigated. |
This avoids potential divide by zero error when calling `AtomicBitmap::new`. Signed-off-by: Jonathan Woollett-Light <[email protected]>
4fb8875
to
6651fa1
Compare
This avoids potential divide by zero error.
Fixes #268
Summary of the PR
Please summarize here why the changes in this PR are needed.
Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s
), and the commitmessage has max 60 characters for the summary and max 75 characters for each
description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafe
code is properly documented.