mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
storage_file: Compute QCOW2 cluster size as ULL
While the QCOW2 cluster size is represented in only 4 bits in the QCOW2 header and thus 1 << cluster_size cannot overflow int, qcow2GetClusterSize is supposed to return unsigned long long so we can just compute the result as ULL rather than computing it as int and promoting to unsigned long long. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
d5b3c62e81
commit
5198c2542a
@ -487,7 +487,7 @@ qcow2GetClusterSize(const char *buf,
|
||||
clusterBits = virReadBufInt32BE(buf + QCOWX_HDR_CLUSTER_BITS_OFFSET);
|
||||
|
||||
if (clusterBits > 0)
|
||||
return 1 << clusterBits;
|
||||
return 1ULL << clusterBits;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user