qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

qemu-img.c possibly overflowing shifts by BDRV_SECTOR_BITS


From: Peter Maydell
Subject: qemu-img.c possibly overflowing shifts by BDRV_SECTOR_BITS
Date: Tue, 9 Nov 2021 19:07:15 +0000

Hi; Coverity is complaining about some of the places in qemu-img.c
where it takes a 32-bit variable and shifts it left by BDRV_SECTOR_BITS
to convert a sector count to a byte count, because it's doing the
shift in 32-bits rather than 64 and so Coverity thinks there might
be overflow (CID 1465221, 1465219). Is it right and we need extra
casts to force the shift to be done in 64 bits, or is there some
constraint that means we know the sector counts are always small
enough that the byte count is 2GB or less ?

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]