diff options
author | Fam Zheng <famz@redhat.com> | 2015-04-27 22:23:01 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2015-04-28 15:36:11 +0200 |
commit | 7237aecd7e8fcc3ccf7fded77b6c127b4df5d3ac (patch) | |
tree | 9a2cfb0a3d9aca8575f2d190a22fca89142e1b7d /block/vmdk.c | |
parent | 5505e8b76f86f925c35ecc2b2d311886bb36534c (diff) |
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 <famz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/vmdk.c')
-rw-r--r-- | block/vmdk.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/block/vmdk.c b/block/vmdk.c index fd94b8f605..1c5e2ef1b3 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -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, |