fs: clean up after mandatory file locking support removal
Subsystems (2)
PATCH 1/1 fs: clean up after mandatory file locking support removal
Commit 3efee0567b4a ("fs: remove mandatory file locking support") removes some operations in functions rw_verify_area() and remap_verify_area().
As these functions are now simplified, do some syntactic clean-up as follow-up to the removal as well, which was pointed out by compiler warnings and static analysis.
No functional change.
---
Jeff, please pick this clean-up patch on top of the commit above.
fs/read_write.c | 10 +++------- fs/remap_range.c | 2 -- 2 files changed, 3 insertions(+), 9 deletions(-)
fs/read_write.c +3 -7
@@ -365,12 +365,8 @@ SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,int rw_verify_area (int read_write,struct file *file,const loff_t *ppos,size_t count) { -struct inode *inode; -int retval = -EINVAL ; - - inode =file_inode (file);if (unlikely ((ssize_t ) count <0 )) -return retval; +return -EINVAL ;/* * ranged mandatory locking does not apply to streams - it makes sense
@@ -381,12 +377,12 @@ int rw_verify_area(int read_write, struct file *file, const loff_t *ppos, size_tif (unlikely (pos <0 )) {if (!unsigned_offsets (file)) -return retval; +return -EINVAL ;if (count >= -pos)/* both values are in 0..LLONG_MAX */ return -EOVERFLOW ; }else if (unlikely ((loff_t) (pos + count) <0 )) {if (!unsigned_offsets (file)) -return retval; +return -EINVAL ; } }
fs/remap_range.c +0 -2
@@ -99,8 +99,6 @@ static int generic_remap_checks(struct file *file_in, loff_t pos_in,static int remap_verify_area (struct file *file,loff_t pos,loff_t len,bool write) { -struct inode *inode =file_inode (file); -if (unlikely (pos <0 || len <0 ))return -EINVAL ;
Signature · 1 line
2.26.2
Quoted 55 lines · Lukas Bulwahn
Commit
3efee0567b4a("fs: remove mandatory file locking support") removes some operations in functionsrw_verify_area()andremap_verify_area().As these functions are now simplified, do some syntactic clean-up as follow-up to the removal as well, which was pointed out by compiler warnings and static analysis.
No functional change.
Signed-off-by Lukas Bulwahn <[email protected]>---
Jeff, please pick this clean-up patch on top of the commit above.fs/read_write.c | 10 +++------- fs/remap_range.c | 2 -- 2 files changed, 3 insertions(+), 9 deletions(-)fs/read_write.c +3
-7@@ -365,12 +365,8 @@ SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,int rw_verify_area (int read_write,struct file *file,const loff_t *ppos,size_t count) { -struct inode *inode; -int retval = -EINVAL ; - - inode =file_inode (file);if (unlikely ((ssize_t ) count <0 )) -return retval; +return -EINVAL ;/* * ranged mandatory locking does not apply to streams - it makes sense @@ -381,12 +377,12 @@ int rw_verify_area(int read_write, struct file *file, const loff_t *ppos, size_tif (unlikely (pos <0 )) {if (!unsigned_offsets (file)) -return retval; +return -EINVAL ;if (count >= -pos)/* both values are in 0..LLONG_MAX */ return -EOVERFLOW ; }else if (unlikely ((loff_t) (pos + count) <0 )) {if (!unsigned_offsets (file)) -return retval; +return -EINVAL ; } }fs/remap_range.c +0
-0
fs/remap_range.c static int generic_remap_checks(struct file *file_in, loff_t pos_in, · line 104
Quoted 8 lines
fs/remap_range.c +0
-2@@ -99,8 +99,6 @@ static int generic_remap_checks(struct file *file_in, loff_t pos_in,static int remap_verify_area (struct file *file,loff_t pos,loff_t len,bool write) { -struct inode *inode =file_inode (file); -if (unlikely (pos <0 || len <0 ))return -EINVAL ;
Thanks Lukas,
I had already removed the second hunk, but I merged read_write.c part into my queue for v5.15. It should show up in linux-next soon.
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 68 lines · Jeff Layton
Quoted 55 lines · Lukas Bulwahn
Commit
3efee0567b4a("fs: remove mandatory file locking support") removes some operations in functionsrw_verify_area()andremap_verify_area().As these functions are now simplified, do some syntactic clean-up as follow-up to the removal as well, which was pointed out by compiler warnings and static analysis.
No functional change.
Signed-off-by Lukas Bulwahn <[email protected]>---
Jeff, please pick this clean-up patch on top of the commit above.fs/read_write.c | 10 +++------- fs/remap_range.c | 2 -- 2 files changed, 3 insertions(+), 9 deletions(-)fs/read_write.c +3
-7@@ -365,12 +365,8 @@ SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,int rw_verify_area (int read_write,struct file *file,const loff_t *ppos,size_t count) { -struct inode *inode; -int retval = -EINVAL ; - - inode =file_inode (file);if (unlikely ((ssize_t ) count <0 )) -return retval; +return -EINVAL ;/* * ranged mandatory locking does not apply to streams - it makes sense @@ -381,12 +377,12 @@ int rw_verify_area(int read_write, struct file *file, const loff_t *ppos, size_tif (unlikely (pos <0 )) {if (!unsigned_offsets (file)) -return retval; +return -EINVAL ;if (count >= -pos)/* both values are in 0..LLONG_MAX */ return -EOVERFLOW ; }else if (unlikely ((loff_t) (pos + count) <0 )) {if (!unsigned_offsets (file)) -return retval; +return -EINVAL ; } }fs/remap_range.c +0
-0fs/remap_range.c static int generic_remap_checks(struct file *file_in, loff_t pos_in, · line 104
Quoted 8 lines
fs/remap_range.c +0
-2@@ -99,8 +99,6 @@ static int generic_remap_checks(struct file *file_in, loff_t pos_in,static int remap_verify_area (struct file *file,loff_t pos,loff_t len,bool write) { -struct inode *inode =file_inode (file); -if (unlikely (pos <0 || len <0 ))return -EINVAL ;Thanks Lukas,
Quoted 2 lines
I had already removed the second hunk, but I merged
read_write.cpart into my queue for v5.15. It should show up in linux-next soon.
Yeah, I guess the issue on the second hunk caused a compiler warning (so more obvious) and was reported otherwise; the issue around the first hunk is only discovered with a bit more involved static analysis, done by clang-analyzer, coccinelle scripts and friends.
Lukas