vmdk: Widen before shifting 32 bit header field
PATCH 1/1 vmdk: Widen before shifting 32 bit header field
Coverity spotted this.
The field is 32 bits, but if it's possible to overflow in 32 bit left shift.
Signed-off-by Fam Zheng <[email protected]>
--- block/vmdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/vmdk.c +1 -1
@@ -523,7 +523,7 @@ static int vmdk_open_vmfs_sparse(BlockDriverState *bs, } ret = vmdk_add_extent(bs, file, false, le32_to_cpu(header.disk_sectors), - le32_to_cpu(header.l1dir_offset) << 9, + (int64_t)le32_to_cpu(header.l1dir_offset) << 9, 0, le32_to_cpu(header.l1dir_size), 4096,
Signature · 1 line
1.9.3
Quoted 16 lines · Fam Zheng
Coverity spotted this.
The field is 32 bits, but if it's possible to overflow in 32 bit left shift.
Signed-off-by Fam Zheng <[email protected]>--- block/vmdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)block/vmdk.c +0
-0
block/vmdk.c static int vmdk_open_vmfs_sparse(BlockDriverState *bs, · line 529
Quoted 8 lines
block/vmdk.c +1
-1@@ -523,7 +523,7 @@ static int vmdk_open_vmfs_sparse(BlockDriverState *bs, } ret = vmdk_add_extent(bs, file, false, le32_to_cpu(header.disk_sectors), - le32_to_cpu(header.l1dir_offset) << 9, + (int64_t)le32_to_cpu(header.l1dir_offset) << 9, 0, le32_to_cpu(header.l1dir_size), 4096,
Reviewed-by John Snow <[email protected]>
Kevin Wolf
AppliedAm 27.04.2015 um 19:07 hat John Snow geschrieben:
Quoted 13 lines · Fam Zheng
Quoted 10 lines
Coverity spotted this.
The field is 32 bits, but if it's possible to overflow in 32 bit left shift.
Signed-off-by Fam Zheng <[email protected]>--- block/vmdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
Quoted 6 lines
block/vmdk.c +0
-0block/vmdk.c static int vmdk_open_vmfs_sparse(BlockDriverState *bs, · line 529
Quoted 8 lines
block/vmdk.c +1
-1@@ -523,7 +523,7 @@ static int vmdk_open_vmfs_sparse(BlockDriverState *bs, } ret = vmdk_add_extent(bs, file, false, le32_to_cpu(header.disk_sectors), - le32_to_cpu(header.l1dir_offset) << 9, + (int64_t)le32_to_cpu(header.l1dir_offset) << 9, 0, le32_to_cpu(header.l1dir_size), 4096,Reviewed-by John Snow <[email protected]>
Thanks, applied to the block branch.
Kevin