mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-22 14:09:22 +00:00
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: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
9f845b1115
commit
f832aa3222
@ -560,7 +560,7 @@ virStorageBackendDiskPartBoundaries(virStoragePoolObjPtr pool,
|
|||||||
unsigned long long extraBytes = 0;
|
unsigned long long extraBytes = 0;
|
||||||
unsigned long long alignedAllocation = allocation;
|
unsigned long long alignedAllocation = allocation;
|
||||||
virStoragePoolSourceDevicePtr dev = &pool->def->source.devices[0];
|
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;
|
dev->geometry.sectors * SECTOR_SIZE;
|
||||||
|
|
||||||
VIR_DEBUG("find free area: allocation %llu, cyl size %llu", allocation,
|
VIR_DEBUG("find free area: allocation %llu, cyl size %llu", allocation,
|
||||||
|
Loading…
Reference in New Issue
Block a user