fs: update len properly when search range exceeds isize
Subsystems (2)
PATCH 1/3 fs: update len properly when search range exceeds isize
__generic_block_fiemap() looks up extents within isize, so original function truncate len to isize if len >= isize, but when start > 0, start + len would still be greater than isize.
Update len properly in this patch.
Signed-off-by Fan Li <[email protected]>
--- fs/ioctl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/ioctl.c +5 -2
@@ -268,9 +268,12 @@ int __generic_block_fiemap(struct inode *inode,* since we expect isize to not change at all through the duration of * this call. */ -if (len >= isize) { +if (start >= isize) +return 0 ; + +if (start + len > isize) { whole_file = true; - len = isize; + len = isize - start; }/*
Signature · 1 line
1.7.9.5
Re: [PATCH 1/3] update len properly when search range exceeds isize
Quoted 20 lines · Fan Li
__generic_block_fiemap()looks up extents within isize, so original function truncate len to isize if len >= isize, but when start > 0, start + len would still be greater than isize.
Update len properly in this patch.Signed-off-by Fan Li <[email protected]>---
fs/ioctl.c| 7 +++++--1 file changed, 5 insertions(+), 2 deletions(-)fs/ioctl.c +0
-1@@ -268,9 +268,12 @@ int __generic_block_fiemap(struct inode *inode,* since we expect isize to not change at all through the duration of * this call. */ -if (len >= isize) {
fs/ioctl.c int __generic_block_fiemap(struct inode *inode, · line 279
Quoted 10 lines
fs/ioctl.c +5
-1+if (start >= isize) +return 0 ; + +if (start + len > isize) { whole_file = true; - len = isize; + len = isize - start; }/*
Reviewed-by Andreas Dilger <[email protected]>
Cheers, Andreas