Page MenuHomeFreeBSD

vfs: fix vfs_bio_bzero_buf() for PAGE_SIZE > block size
Needs ReviewPublic

Authored by chs on Sep 25 2025, 6:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 16, 9:45 AM
Unknown Object (File)
Fri, Nov 7, 7:32 AM
Unknown Object (File)
Mon, Nov 3, 12:58 AM
Unknown Object (File)
Oct 26 2025, 3:29 PM
Unknown Object (File)
Oct 25 2025, 4:55 PM
Unknown Object (File)
Oct 25 2025, 1:28 PM
Unknown Object (File)
Oct 23 2025, 7:57 AM
Unknown Object (File)
Oct 17 2025, 11:11 AM
Subscribers

Details

Reviewers
imp
kib
markj
Summary

The "base" argument to vfs_bio_bzero_buf() is the offset within
the buf, but when the page size is larger than the buf size
then the buf might not start at the beginning of its page.
Add the offset of the buf within the page to account for this.

Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 67334
Build 64217: arc lint + arc unit

Event Timeline

chs requested review of this revision.Sep 25 2025, 6:27 PM

Consider an example where base == PAGE_SIZE / 2, b_offset == PAGE_SIZE / 2. In this case pgoff == PAGE_SIZE, n = 0, and each iteration of the loop seems to do nothing.

And generally pgoff might be larger than PAGE_SIZE, in which case n become negative.