littlekernel / lk

LK embedded kernel
MIT License
3.11k stars 613 forks source link

[virtio-block] bug in non VM path #325

Open travisg opened 2 years ago

travisg commented 2 years ago

https://github.com/littlekernel/lk/blob/5cbe21919bd4310fc13eb05816a8fed64f7079b9/dev/virtio/block/virtio-block.c#L237

The above code has an issue where in the non VM path it doesn't subtract from the len variable, this the code returns non zero, which causes the block based virtio wrappers to return an error.

Really, the function should return the total number of queued bytes and the wrapper should pass back non zero, but both the VM and non VM path need to be cleaned up and fixed.