X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=fs%2Fioctl.c;h=7b17a14396ff792152ae6da49d178355d5a5e7ea;hb=7ca263cdf8cf74d0f1c6f48d07d556de92e3bec9;hp=5612880fcbe7d7436f3579c7c1add7360170e407;hpb=fc8e1ead9314cf0e0f1922e661428b93d3a50d88;p=linux-block.git diff --git a/fs/ioctl.c b/fs/ioctl.c index 5612880fcbe7..7b17a14396ff 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -162,20 +162,21 @@ EXPORT_SYMBOL(fiemap_check_flags); static int fiemap_check_ranges(struct super_block *sb, u64 start, u64 len, u64 *new_len) { + u64 maxbytes = (u64) sb->s_maxbytes; + *new_len = len; if (len == 0) return -EINVAL; - if (start > sb->s_maxbytes) + if (start > maxbytes) return -EFBIG; /* * Shrink request scope to what the fs can actually handle. */ - if ((len > sb->s_maxbytes) || - (sb->s_maxbytes - len) < start) - *new_len = sb->s_maxbytes - start; + if (len > maxbytes || (maxbytes - len) < start) + *new_len = maxbytes - start; return 0; }