All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block-backend: Silence clang -m32 compiler warning
@ 2021-10-26  9:07 Hanna Reitz
  2021-10-26 10:31 ` Philippe Mathieu-Daudé
  2021-11-02 12:22 ` Kevin Wolf
  0 siblings, 2 replies; 3+ messages in thread
From: Hanna Reitz @ 2021-10-26  9:07 UTC (permalink / raw)
  To: qemu-block
  Cc: Kevin Wolf, Hanna Reitz, Vladimir Sementsov-Ogievskiy,
	Eric Blake, qemu-devel

Similarly to e7e588d432d31ecebc26358e47201dd108db964c, there is a
warning in block/block-backend.c that qiov->size <= INT64_MAX is always
true on machines where size_t is narrower than a uint64_t.  In said
commit, we silenced this warning by casting to uint64_t.

The commit introducing this warning here
(a93d81c84afa717b0a1a6947524d8d1fbfd6bbf5) anticipated it and so tried
to address it the same way.  However, it only did so in one of two
places where this comparison occurs, and so we still need to fix up the
other one.

Fixes: a93d81c84afa717b0a1a6947524d8d1fbfd6bbf5
       ("block-backend: convert blk_aio_ functions to int64_t bytes
       paramter")
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
 block/block-backend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index 39cd99df2b..12ef80ea17 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1540,7 +1540,7 @@ BlockAIOCB *blk_aio_pwritev(BlockBackend *blk, int64_t offset,
                             QEMUIOVector *qiov, BdrvRequestFlags flags,
                             BlockCompletionFunc *cb, void *opaque)
 {
-    assert(qiov->size <= INT64_MAX);
+    assert((uint64_t)qiov->size <= INT64_MAX);
     return blk_aio_prwv(blk, offset, qiov->size, qiov,
                         blk_aio_write_entry, flags, cb, opaque);
 }
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] block-backend: Silence clang -m32 compiler warning
  2021-10-26  9:07 [PATCH] block-backend: Silence clang -m32 compiler warning Hanna Reitz
@ 2021-10-26 10:31 ` Philippe Mathieu-Daudé
  2021-11-02 12:22 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-10-26 10:31 UTC (permalink / raw)
  To: Hanna Reitz, qemu-block
  Cc: Kevin Wolf, Vladimir Sementsov-Ogievskiy, Eric Blake, qemu-devel

On 10/26/21 11:07, Hanna Reitz wrote:
> Similarly to e7e588d432d31ecebc26358e47201dd108db964c, there is a
> warning in block/block-backend.c that qiov->size <= INT64_MAX is always
> true on machines where size_t is narrower than a uint64_t.  In said
> commit, we silenced this warning by casting to uint64_t.
> 
> The commit introducing this warning here
> (a93d81c84afa717b0a1a6947524d8d1fbfd6bbf5) anticipated it and so tried
> to address it the same way.  However, it only did so in one of two
> places where this comparison occurs, and so we still need to fix up the
> other one.
> 
> Fixes: a93d81c84afa717b0a1a6947524d8d1fbfd6bbf5
>        ("block-backend: convert blk_aio_ functions to int64_t bytes
>        paramter")
> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
> ---
>  block/block-backend.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] block-backend: Silence clang -m32 compiler warning
  2021-10-26  9:07 [PATCH] block-backend: Silence clang -m32 compiler warning Hanna Reitz
  2021-10-26 10:31 ` Philippe Mathieu-Daudé
@ 2021-11-02 12:22 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2021-11-02 12:22 UTC (permalink / raw)
  To: Hanna Reitz
  Cc: Vladimir Sementsov-Ogievskiy, Eric Blake, qemu-devel, qemu-block

Am 26.10.2021 um 11:07 hat Hanna Reitz geschrieben:
> Similarly to e7e588d432d31ecebc26358e47201dd108db964c, there is a
> warning in block/block-backend.c that qiov->size <= INT64_MAX is always
> true on machines where size_t is narrower than a uint64_t.  In said
> commit, we silenced this warning by casting to uint64_t.
> 
> The commit introducing this warning here
> (a93d81c84afa717b0a1a6947524d8d1fbfd6bbf5) anticipated it and so tried
> to address it the same way.  However, it only did so in one of two
> places where this comparison occurs, and so we still need to fix up the
> other one.
> 
> Fixes: a93d81c84afa717b0a1a6947524d8d1fbfd6bbf5
>        ("block-backend: convert blk_aio_ functions to int64_t bytes
>        paramter")
> Signed-off-by: Hanna Reitz <hreitz@redhat.com>

Thanks, applied to the block branch.

Kevin



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-02 12:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26  9:07 [PATCH] block-backend: Silence clang -m32 compiler warning Hanna Reitz
2021-10-26 10:31 ` Philippe Mathieu-Daudé
2021-11-02 12:22 ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.