mirror_zfs/module/os/linux/zfs
Richard Yao dd108f5d73
Linux: zfs_fillpage() should handle partial pages from end of file
After 89cd2197b9 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 89cd2197b9, 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.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14534
2023-03-01 13:19:47 -08:00
..
abd_os.c Add assertion and make variables unsigned in abd_alloc_chunks() 2023-02-06 11:10:50 -08:00
arc_os.c Cleanup: 64-bit kernel module parameters should use fixed width types 2022-10-13 10:03:29 -07:00
mmp_os.c Cleanup: 64-bit kernel module parameters should use fixed width types 2022-10-13 10:03:29 -07:00
policy.c Support idmapped mount in user namespace 2022-11-08 10:28:56 -08:00
qat_compress.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
qat_crypt.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
qat.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
spa_misc_os.c Cleanup: 64-bit kernel module parameters should use fixed width types 2022-10-13 10:03:29 -07:00
trace.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
vdev_disk.c Cleanup of dead code suggested by Clang Static Analyzer (#14380) 2023-01-17 09:57:12 -08:00
vdev_file.c Cleanup: 64-bit kernel module parameters should use fixed width types 2022-10-13 10:03:29 -07:00
zfs_acl.c Cleanup of dead code suggested by Clang Static Analyzer (#14380) 2023-01-17 09:57:12 -08:00
zfs_ctldir.c Linux: use filemap_range_has_page() 2023-02-14 11:04:34 -08:00
zfs_debug.c Cleanup: Replace oldstyle struct hack with C99 flexible array members 2023-01-12 16:00:03 -08:00
zfs_dir.c Fix unprotected zfs_znode_dmu_fini 2023-01-19 16:59:05 -08:00
zfs_file_os.c Cleanup: Remove branches that always evaluate the same way 2022-11-03 10:47:48 -07:00
zfs_ioctl_os.c Reduce need for contiguous memory for ioctls 2023-02-13 16:35:59 -08:00
zfs_racct.c module: zfs: fix unused, remove argsused 2021-12-23 09:42:47 -08:00
zfs_sysfs.c Introduce kmem_scnprintf() 2022-10-29 13:05:11 -07:00
zfs_uio.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_vfsops.c zfs_get_temporary_prop() should not pass NULL to strcpy() 2023-02-06 11:08:57 -08:00
zfs_vnops_os.c Linux: zfs_fillpage() should handle partial pages from end of file 2023-03-01 13:19:47 -08:00
zfs_znode.c Linux: use filemap_range_has_page() 2023-02-14 11:04:34 -08:00
zio_crypt.c Fix GCC 12 compilation errors 2022-11-30 13:45:53 -08:00
zpl_ctldir.c Support idmapped mount in user namespace 2022-11-08 10:28:56 -08:00
zpl_export.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zpl_file.c Fix buffered/direct/mmap I/O race 2023-02-23 10:57:24 -08:00
zpl_inode.c linux 6.2 compat: get_acl() got moved to get_inode_acl() in 6.2 2023-01-06 14:40:54 -08:00
zpl_super.c Prevent incorrect datasets being mounted 2023-02-27 16:49:34 -08:00
zpl_xattr.c linux 6.2 compat: zpl_set_acl arg2 is now struct dentry 2023-01-24 11:20:50 -08:00
zvol_os.c Optionally skip zil_close during zvol_create_minor_impl 2022-11-08 12:38:08 -08:00