[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/15] qcow2: Silence clang -m32 compiler warning
From: |
Eric Blake |
Subject: |
[PULL 01/15] qcow2: Silence clang -m32 compiler warning |
Date: |
Fri, 15 Oct 2021 16:09:56 -0500 |
From: Hanna Reitz <hreitz@redhat.com>
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: f7ef38dd1310d7d9db76d0aa16899cbc5744f36d
("block: use int64_t instead of uint64_t in driver read
handlers")
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20211011155031.149158-1-hreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
block/qcow2-cluster.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 5727f92dcb39..21884a1ab9ab 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -513,7 +513,8 @@ static int coroutine_fn
do_perform_cow_read(BlockDriverState *bs,
*/
assert(src_cluster_offset <= INT64_MAX);
assert(src_cluster_offset + offset_in_cluster <= INT64_MAX);
- assert(qiov->size <= INT64_MAX);
+ /* Cast qiov->size to uint64_t to silence a compiler warning on -m32 */
+ assert((uint64_t)qiov->size <= INT64_MAX);
bdrv_check_qiov_request(src_cluster_offset + offset_in_cluster, qiov->size,
qiov, 0, &error_abort);
/*
--
2.31.1
- [PULL 00/15] NBD patches through 2021-10-15, Eric Blake, 2021/10/15
- [PULL 05/15] block-backend: convert blk_co_pdiscard to int64_t bytes, Eric Blake, 2021/10/15
- [PULL 01/15] qcow2: Silence clang -m32 compiler warning,
Eric Blake <=
- [PULL 04/15] block-backend: convert blk_co_pwritev_part to int64_t bytes, Eric Blake, 2021/10/15
- [PULL 02/15] block-backend: blk_check_byte_request(): int64_t bytes, Eric Blake, 2021/10/15
- [PULL 06/15] block-backend: rename _do_ helper functions to _co_do_, Eric Blake, 2021/10/15
- [PULL 03/15] block-backend: make blk_co_preadv() 64bit, Eric Blake, 2021/10/15
- [PULL 08/15] block-backend: drop blk_prw, use block-coroutine-wrapper, Eric Blake, 2021/10/15
- [PULL 11/15] block-backend: convert blk_aio_ functions to int64_t bytes paramter, Eric Blake, 2021/10/15
- [PULL 09/15] block-backend: convert blk_foo wrappers to use int64_t bytes parameter, Eric Blake, 2021/10/15
- [PULL 10/15] block-backend: convert blk_co_copy_range to int64_t bytes, Eric Blake, 2021/10/15
- [PULL 07/15] block-coroutine-wrapper.py: support BlockBackend first argument, Eric Blake, 2021/10/15
- [PULL 12/15] block-backend: blk_pread, blk_pwrite: rename count parameter to bytes, Eric Blake, 2021/10/15