提交 f832aa32 编写于 作者: J John Ferlan

storage: Resolve Coverity OVERFLOW_BEFORE_WIDEN

Coverity complains that when multiplying to 32 bit values that eventually
will be stored in a 64 bit value that it's possible the math could
overflow unless one of the values being multiplied is type cast to
the proper size.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 9f845b11
......@@ -560,7 +560,7 @@ virStorageBackendDiskPartBoundaries(virStoragePoolObjPtr pool,
unsigned long long extraBytes = 0;
unsigned long long alignedAllocation = allocation;
virStoragePoolSourceDevicePtr dev = &pool->def->source.devices[0];
unsigned long long cylinderSize = dev->geometry.heads *
unsigned long long cylinderSize = (unsigned long long)dev->geometry.heads *
dev->geometry.sectors * SECTOR_SIZE;
VIR_DEBUG("find free area: allocation %llu, cyl size %llu", allocation,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册