summaryrefslogtreecommitdiff
path: root/fs/hfsplus/wrapper.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@tuxera.com>2011-02-16 11:34:22 +0300
committerChristoph Hellwig <hch@lst.de>2011-06-30 15:40:59 +0400
commit4ba2d5fdcfd19de0dedf394ddc48db2f219fa89a (patch)
tree5f90b4f4c98f54528e65c81a531bdc829c1efd17 /fs/hfsplus/wrapper.c
parentbf1a1b31fa3ea24e3a90821d69a5c3da066f7d6c (diff)
downloadlinux-4ba2d5fdcfd19de0dedf394ddc48db2f219fa89a.tar.xz
hfsplus: fix overflow in hfsplus_read_wrapper
For partitions larger than 2TB or at such an offset the hfs wrapper code in hfsplus might overflow the range representable in a 32-bit data type. Make sure we use a sector_t for the arithmetics leading to it. I'm not sure this code can be readed at all as hfs itself never supported such large volumes. Signed-off-by: Christoph Hellwig <hch@tuxera.com>
Diffstat (limited to 'fs/hfsplus/wrapper.c')
-rw-r--r--fs/hfsplus/wrapper.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c
index 4ac88ff79aa6..4b86468125c1 100644
--- a/fs/hfsplus/wrapper.c
+++ b/fs/hfsplus/wrapper.c
@@ -172,8 +172,9 @@ reread:
if (!hfsplus_read_mdb(sbi->s_vhdr, &wd))
goto out_free_backup_vhdr;
wd.ablk_size >>= HFSPLUS_SECTOR_SHIFT;
- part_start += wd.ablk_start + wd.embed_start * wd.ablk_size;
- part_size = wd.embed_count * wd.ablk_size;
+ part_start += (sector_t)wd.ablk_start +
+ (sector_t)wd.embed_start * wd.ablk_size;
+ part_size = (sector_t)wd.embed_count * wd.ablk_size;
goto reread;
default:
/*