Skip to content

Commit e7e588d

Browse files
XanClicebblake
authored andcommitted
qcow2: Silence clang -m32 compiler warning
With -m32, size_t is generally only a uint32_t. That makes clang complain that in the assertion assert(qiov->size <= INT64_MAX); the range of the type of qiov->size (size_t) is too small for any of its values to ever exceed INT64_MAX. Cast qiov->size to uint64_t to silence clang. Fixes: f7ef38d ("block: use int64_t instead of uint64_t in driver read handlers") Signed-off-by: Hanna Reitz <[email protected]> Message-Id: <[email protected]> Reviewed-by: Eric Blake <[email protected]> Signed-off-by: Eric Blake <[email protected]>
1 parent 253e399 commit e7e588d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

block/qcow2-cluster.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,8 @@ static int coroutine_fn do_perform_cow_read(BlockDriverState *bs,
513513
*/
514514
assert(src_cluster_offset <= INT64_MAX);
515515
assert(src_cluster_offset + offset_in_cluster <= INT64_MAX);
516-
assert(qiov->size <= INT64_MAX);
516+
/* Cast qiov->size to uint64_t to silence a compiler warning on -m32 */
517+
assert((uint64_t)qiov->size <= INT64_MAX);
517518
bdrv_check_qiov_request(src_cluster_offset + offset_in_cluster, qiov->size,
518519
qiov, 0, &error_abort);
519520
/*

0 commit comments

Comments
 (0)