On 04/27/2015 10:23 AM, Fam Zheng wrote:
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 <f...@redhat.com>
---
  block/vmdk.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/vmdk.c b/block/vmdk.c
index 8410a15..d72a6e8 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,


Reviewed-by: John Snow <js...@redhat.com>

Reply via email to