]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: clean up len and offset checks in ext4_fallocate()
authorEric Biggers <ebiggers@google.com>
Tue, 31 Dec 2019 18:04:38 +0000 (12:04 -0600)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 17 Jan 2020 21:24:54 +0000 (16:24 -0500)
commit3e32e4e56f9a167fba660d7ce97f97b67acdcb1d
tree7b28f65ccfc3d875ff086079e13370332c6120d8
parentfb5c6f718286853b5e64607c0f02e915c22f5ff4
ext4: clean up len and offset checks in ext4_fallocate()

- Fix some comments.

- Consistently access i_size directly rather than using i_size_read(),
  since in all relevant cases we're under inode_lock().

- Simplify the alignment checks by using the IS_ALIGNED() macro.

- In ext4_insert_range(), do the check against s_maxbytes in a way
  that is safe against signed overflow.  (This doesn't currently matter
  for ext4 due to ext4's limited max file size, but this is something
  other filesystems have gotten wrong.  We might as well do it safely.)

Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20191231180444.46586-3-ebiggers@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: Jan Kara <jack@suse.cz>
fs/ext4/extents.c