On Mon, Oct 11, 2021 at 05:50:31PM +0200, Hanna Reitz wrote:
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.
Yep, I'm not surprised that we hit that.
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>
---
I don't know whether this is the best possible solution, or whether we
should care about this at all (I personally think it's basically just
wrong for clang to warn about always-true conditions in assertions), but
I thought I might as well just send this patch as the basis for a
discussion.
I agree that the compiler is overly noisy, but the fix is simple
enough that I'm fine with it as written.