On Fri, Jun 11, 2021 at 03:59:04PM -0400, Jeff Layton wrote: > if ((pos_in_page == 0 && len == PAGE_SIZE) || > - (pos >= i_size_read(inode)) || > + (index > (i_size_read(inode) / PAGE_SIZE)) || I think that wants to be ((i_size_read(inode) - 1) / PAGE_SIZE) If your file is 4096 bytes long, that means bytes 0-4095 contain data. Except that i_size can be 0, so ... if ((offset == 0 && len == PAGE_SIZE) || i_size == 0 || (index > (i_size - 1) / PAGE_SIZE) || (offset == 0 && pos + len >= i_size)) zero_user_segments(page, 0, pos_in_page, pos_in_page + len, PAGE_SIZE);