cloudius-systems / osv

OSv, a new operating system for the cloud.
osv.io
Other
4.05k stars 603 forks source link

block cache: use correct data type for block number #1312

Closed wkozaczuk closed 1 week ago

wkozaczuk commented 2 weeks ago

This issue was discovered by Jan Braunwarth when implementing the NVMe driver and full credit goes to him.

The b_blkno field of the buf struct uses 4-bytes int type and may cause overflow when block cache is used by bdev_read() and bdev_write() in devfs. To correct this, we changed the type to off_t.