Use u32
to describe descriptor chain lengths
#4548
Labels
Good first issue
Indicates a good issue for first-time contributors
u32
to describe descriptor chain lengths
#4548
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: