-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 u32
to describe descriptor chain lengths
#4548
Labels
Good first issue
Indicates a good issue for first-time contributors
Comments
bchalios
added
the
Good first issue
Indicates a good issue for first-time contributors
label
Apr 9, 2024
hey i want to work in this issue do i need to make changes for IoVecBufferMut and IoVecBuffer both |
Hey @BipulLamsal thanks for your interest in this. I think there was someone already working on this. Let me confirm with them and I will come back to you. |
9 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Currently, parts of our virtio code use usize to describe the lengths of descriptor chains [1], while other parts use u32, which results in some ugly casts that can panic if a descriptor chain with length exceeding 2^32-1 bytes slips through validation somehow [2]. According to the virtio spec, descriptor chains can be at most 2^32-1 bytes long (as the "len" parameter in the used ring is a u32). We should thus use u32 instead of usize to describe these lengths, and upcast when interacting with non-virtio code that expects lengths to be usize.
Solution
The text was updated successfully, but these errors were encountered: