Skip to content
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

Linux: zfs_fillpage() should handle partial pages from end of file #14534

Merged
merged 1 commit into from
Mar 1, 2023

Commits on Feb 28, 2023

  1. Linux: zfs_fillpage() should handle partial pages from end of file

    After 89cd219 was merged, Clang's
    static analyzer began complaining about a dead assignment in
    `zfs_fillpage()`. Upon inspection, I noticed that the dead assignment
    was because we are not using the calculated io_len that we should use to
    avoid asking the DMU to read past the end of a file. This should result
    in `dmu_buf_hold_array_by_dnode()` calling `zfs_panic_recover()`.
    
    This issue predates 89cd219, but its
    simplification of zfs_fillpage() eliminated the only use of the
    assignment to io_len, which made Clang's static analyzer complain about
    the issue.
    
    Also, as a precaution, we add an assertion that io_offset < i_size. If
    this ever fails, bad things will happen. Otherwise, we are blindly
    trusting the kernel not to give us invalid offsets. We continue to
    blindly trust it on non-debug kernels.
    
    Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
    ryao committed Feb 28, 2023
    Configuration menu
    Copy the full SHA
    bf6a33c View commit details
    Browse the repository at this point in the history