Skip to content
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

Relax assertions for zero-length accesses (for v0.1.2) #107

Merged
merged 2 commits into from
Aug 5, 2020

Conversation

alexandruag
Copy link
Collaborator

Related to #106

Relax the assertions from write_to and read_from to allow equality between offset and count, which no longer leads to panics when zero-length accesses happen. This is preferred versus adding an explicit check for count or len == 0 somewhere, because we don't end up with an additional branch on the regular path. Also tweaked the try_access logic a bit, to return Ok(0) when total == 0 but we found a valid region associated with the current address (which indicates a zero-length access).

Relax the assertions from write_to and read_from to allow equality
between offset and count, which no longer leads to panics when
zero-length accesses happen. This is preferred versus adding an
explicit check for count or len == 0 somewhere, because we don't end
up with an additional branch on the regular path. Also tweaked the
try_access logic a bit, to return Ok(0) when total == 0 but we found
a valid region associated with the current address (which indicates
a zero-length access).

Signed-off-by: Alexandru Agache <aagch@amazon.com>
Updated version in Cargo.toml.

Signed-off-by: Alexandru Agache <aagch@amazon.com>
@alexandruag alexandruag self-assigned this Aug 3, 2020
@andreeaflorescu andreeaflorescu merged commit 90f6f67 into rust-vmm:v0.1.2_release Aug 5, 2020
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.

None yet

3 participants