On Jan 10, 2016, at 11:25 PM, Fan Li <fanofcode.li@xxxxxxxxxxx> 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@xxxxxxxxxxx> > --- > 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@xxxxxxxxx> Cheers, Andreas
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail