summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.h
diff options
context:
space:
mode:
authorLiu Bo2016-04-27 02:53:31 +0200
committerDavid Sterba2016-05-06 15:22:49 +0200
commit3d8da67817606380fdadfa483d4dba5c3a5446c6 (patch)
treed05f21fa3739c0566f9de77b5588336bb0fff442 /fs/btrfs/volumes.h
parentbtrfs: sysfs: protect reading label by lock (diff)
downloadkernel-qcow2-linux-3d8da67817606380fdadfa483d4dba5c3a5446c6.tar.gz
kernel-qcow2-linux-3d8da67817606380fdadfa483d4dba5c3a5446c6.tar.xz
kernel-qcow2-linux-3d8da67817606380fdadfa483d4dba5c3a5446c6.zip
Btrfs: fix divide error upon chunk's stripe_len
The struct 'map_lookup' uses type int for @stripe_len, while btrfs_chunk_stripe_len() can return a u64 value, and it may end up with @stripe_len being undefined value and it can lead to 'divide error' in __btrfs_map_block(). This changes 'map_lookup' to use type u64 for stripe_len, also right now we only use BTRFS_STRIPE_LEN for stripe_len, so this adds a valid checker for BTRFS_STRIPE_LEN. Reported-by: Vegard Nossum <vegard.nossum@oracle.com> Reported-by: Quentin Casasnovas <quentin.casasnovas@oracle.com> Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> [ folded division fix to scrub_raid56_parity ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.h')
-rw-r--r--fs/btrfs/volumes.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 1939ebde63df..7507be74f7da 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -347,7 +347,7 @@ struct map_lookup {
u64 type;
int io_align;
int io_width;
- int stripe_len;
+ u64 stripe_len;
int sector_size;
int num_stripes;
int sub_stripes;