* [PATCH 1/3] fs: update len properly when search range exceeds isize
@ 2016-01-11 6:25 Fan Li
2016-01-11 22:25 ` [PATCH 1/3] " Andreas Dilger
0 siblings, 1 reply; 2+ messages in thread
From: Fan Li @ 2016-01-11 6:25 UTC (permalink / raw)
To: linux-fsdevel
__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 <fanofcode.li@samsung.com>
---
fs/ioctl.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 41c352e..13a3e96 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -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;
}
/*
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/3] update len properly when search range exceeds isize
2016-01-11 6:25 [PATCH 1/3] fs: update len properly when search range exceeds isize Fan Li
@ 2016-01-11 22:25 ` Andreas Dilger
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Dilger @ 2016-01-11 22:25 UTC (permalink / raw)
To: Fan Li; +Cc: linux-fsdevel
[-- Attachment #1: Type: text/plain, Size: 969 bytes --]
On Jan 10, 2016, at 11:25 PM, Fan Li <fanofcode.li@samsung.com> wrote:
>
> __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 <fanofcode.li@samsung.com>
> ---
> fs/ioctl.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ioctl.c b/fs/ioctl.c
> index 41c352e..13a3e96 100644
> --- a/fs/ioctl.c
> +++ b/fs/ioctl.c
> @@ -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;
> }
>
> /*
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Cheers, Andreas
[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-11 22:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-11 6:25 [PATCH 1/3] fs: update len properly when search range exceeds isize Fan Li
2016-01-11 22:25 ` [PATCH 1/3] " Andreas Dilger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.