All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block/qcow2-bitmap: Add missing cast to silent GCC error
@ 2022-09-19 18:27 Philippe Mathieu-Daudé via
  2022-09-19 19:10 ` Vladimir Sementsov-Ogievskiy
  2022-09-22 15:37 ` Kevin Wolf
  0 siblings, 2 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-09-19 18:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: Vladimir Sementsov-Ogievskiy, qemu-trivial, Kevin Wolf,
	Eric Blake, qemu-block, John Snow, Hanna Reitz,
	Philippe Mathieu-Daudé,
	Vladimir Sementsov-Ogievskiy, Max Reitz

Commit d1258dd0c8 ("qcow2: autoloading dirty bitmaps") added the
set_readonly_helper() GFunc handler, correctly casting the gpointer
user_data in both the g_slist_foreach() caller and the handler.
Few commits later (commit 1b6b0562db), the handler is reused in
qcow2_reopen_bitmaps_rw() but missing the gpointer cast, resulting
in the following error when using Homebrew GCC 12.2.0:

  [2/658] Compiling C object libblock.fa.p/block_qcow2-bitmap.c.o
  ../../block/qcow2-bitmap.c: In function 'qcow2_reopen_bitmaps_rw':
  ../../block/qcow2-bitmap.c:1211:60: error: incompatible type for argument 3 of 'g_slist_foreach'
   1211 |     g_slist_foreach(ro_dirty_bitmaps, set_readonly_helper, false);
        |                                                            ^~~~~
        |                                                            |
        |                                                            _Bool
  In file included from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/gmain.h:26,
                   from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/giochannel.h:33,
                   from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib.h:54,
                   from /Users/philmd/source/qemu/include/glib-compat.h:32,
                   from /Users/philmd/source/qemu/include/qemu/osdep.h:144,
                   from ../../block/qcow2-bitmap.c:28:
  /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/gslist.h:127:61: note: expected 'gpointer' {aka 'void *'} but argument is of type '_Bool'
    127 |                                           gpointer          user_data);
        |                                           ~~~~~~~~~~~~~~~~~~^~~~~~~~~
  At top level:
  FAILED: libblock.fa.p/block_qcow2-bitmap.c.o

Fix by adding the missing gpointer cast.

Fixes: 1b6b0562db ("qcow2: support .bdrv_reopen_bitmaps_rw")
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: John Snow <jsnow@redhat.com>
Cc: Max Reitz <mreitz@redhat.com>
---
 block/qcow2-bitmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
index ff3309846c..7197754843 100644
--- a/block/qcow2-bitmap.c
+++ b/block/qcow2-bitmap.c
@@ -1208,7 +1208,7 @@ int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp)
         }
     }
 
-    g_slist_foreach(ro_dirty_bitmaps, set_readonly_helper, false);
+    g_slist_foreach(ro_dirty_bitmaps, set_readonly_helper, (gpointer)false);
     ret = 0;
 
 out:
-- 
2.37.3



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

* Re: [PATCH] block/qcow2-bitmap: Add missing cast to silent GCC error
  2022-09-19 18:27 [PATCH] block/qcow2-bitmap: Add missing cast to silent GCC error Philippe Mathieu-Daudé via
@ 2022-09-19 19:10 ` Vladimir Sementsov-Ogievskiy
  2022-09-22 15:37 ` Kevin Wolf
  1 sibling, 0 replies; 4+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2022-09-19 19:10 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Kevin Wolf, Eric Blake, qemu-block, John Snow,
	Hanna Reitz, Vladimir Sementsov-Ogievskiy, Max Reitz

On 9/19/22 21:27, Philippe Mathieu-Daudé wrote:
> Commit d1258dd0c8 ("qcow2: autoloading dirty bitmaps") added the
> set_readonly_helper() GFunc handler, correctly casting the gpointer
> user_data in both the g_slist_foreach() caller and the handler.
> Few commits later (commit 1b6b0562db), the handler is reused in
> qcow2_reopen_bitmaps_rw() but missing the gpointer cast, resulting
> in the following error when using Homebrew GCC 12.2.0:
> 
>    [2/658] Compiling C object libblock.fa.p/block_qcow2-bitmap.c.o
>    ../../block/qcow2-bitmap.c: In function 'qcow2_reopen_bitmaps_rw':
>    ../../block/qcow2-bitmap.c:1211:60: error: incompatible type for argument 3 of 'g_slist_foreach'
>     1211 |     g_slist_foreach(ro_dirty_bitmaps, set_readonly_helper, false);
>          |                                                            ^~~~~
>          |                                                            |
>          |                                                            _Bool
>    In file included from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/gmain.h:26,
>                     from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/giochannel.h:33,
>                     from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib.h:54,
>                     from /Users/philmd/source/qemu/include/glib-compat.h:32,
>                     from /Users/philmd/source/qemu/include/qemu/osdep.h:144,
>                     from ../../block/qcow2-bitmap.c:28:
>    /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/gslist.h:127:61: note: expected 'gpointer' {aka 'void *'} but argument is of type '_Bool'
>      127 |                                           gpointer          user_data);
>          |                                           ~~~~~~~~~~~~~~~~~~^~~~~~~~~
>    At top level:
>    FAILED: libblock.fa.p/block_qcow2-bitmap.c.o
> 
> Fix by adding the missing gpointer cast.
> 
> Fixes: 1b6b0562db ("qcow2: support .bdrv_reopen_bitmaps_rw")
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>

Thanks for fixing! Seems correct for it to go with trivial patches.

-- 
Best regards,
Vladimir


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

* Re: [PATCH] block/qcow2-bitmap: Add missing cast to silent GCC error
  2022-09-19 18:27 [PATCH] block/qcow2-bitmap: Add missing cast to silent GCC error Philippe Mathieu-Daudé via
  2022-09-19 19:10 ` Vladimir Sementsov-Ogievskiy
@ 2022-09-22 15:37 ` Kevin Wolf
  2022-09-29 19:27   ` Laurent Vivier
  1 sibling, 1 reply; 4+ messages in thread
From: Kevin Wolf @ 2022-09-22 15:37 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Vladimir Sementsov-Ogievskiy, qemu-trivial,
	Eric Blake, qemu-block, John Snow, Hanna Reitz,
	Vladimir Sementsov-Ogievskiy, Max Reitz

Am 19.09.2022 um 20:27 hat Philippe Mathieu-Daudé geschrieben:
> Commit d1258dd0c8 ("qcow2: autoloading dirty bitmaps") added the
> set_readonly_helper() GFunc handler, correctly casting the gpointer
> user_data in both the g_slist_foreach() caller and the handler.
> Few commits later (commit 1b6b0562db), the handler is reused in
> qcow2_reopen_bitmaps_rw() but missing the gpointer cast, resulting
> in the following error when using Homebrew GCC 12.2.0:
> 
>   [2/658] Compiling C object libblock.fa.p/block_qcow2-bitmap.c.o
>   ../../block/qcow2-bitmap.c: In function 'qcow2_reopen_bitmaps_rw':
>   ../../block/qcow2-bitmap.c:1211:60: error: incompatible type for argument 3 of 'g_slist_foreach'
>    1211 |     g_slist_foreach(ro_dirty_bitmaps, set_readonly_helper, false);
>         |                                                            ^~~~~
>         |                                                            |
>         |                                                            _Bool
>   In file included from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/gmain.h:26,
>                    from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/giochannel.h:33,
>                    from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib.h:54,
>                    from /Users/philmd/source/qemu/include/glib-compat.h:32,
>                    from /Users/philmd/source/qemu/include/qemu/osdep.h:144,
>                    from ../../block/qcow2-bitmap.c:28:
>   /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/gslist.h:127:61: note: expected 'gpointer' {aka 'void *'} but argument is of type '_Bool'
>     127 |                                           gpointer          user_data);
>         |                                           ~~~~~~~~~~~~~~~~~~^~~~~~~~~
>   At top level:
>   FAILED: libblock.fa.p/block_qcow2-bitmap.c.o
> 
> Fix by adding the missing gpointer cast.
> 
> Fixes: 1b6b0562db ("qcow2: support .bdrv_reopen_bitmaps_rw")
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Thanks, applied to the block branch. And in case qemu-trivial picks it
up anyway:

Reviewed-by: Kevin Wolf <kwolf@redhat.com>



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

* Re: [PATCH] block/qcow2-bitmap: Add missing cast to silent GCC error
  2022-09-22 15:37 ` Kevin Wolf
@ 2022-09-29 19:27   ` Laurent Vivier
  0 siblings, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2022-09-29 19:27 UTC (permalink / raw)
  To: Kevin Wolf, Philippe Mathieu-Daudé
  Cc: qemu-devel, Vladimir Sementsov-Ogievskiy, qemu-trivial,
	Eric Blake, qemu-block, John Snow, Hanna Reitz,
	Vladimir Sementsov-Ogievskiy, Max Reitz

Le 22/09/2022 à 17:37, Kevin Wolf a écrit :
> Am 19.09.2022 um 20:27 hat Philippe Mathieu-Daudé geschrieben:
>> Commit d1258dd0c8 ("qcow2: autoloading dirty bitmaps") added the
>> set_readonly_helper() GFunc handler, correctly casting the gpointer
>> user_data in both the g_slist_foreach() caller and the handler.
>> Few commits later (commit 1b6b0562db), the handler is reused in
>> qcow2_reopen_bitmaps_rw() but missing the gpointer cast, resulting
>> in the following error when using Homebrew GCC 12.2.0:
>>
>>    [2/658] Compiling C object libblock.fa.p/block_qcow2-bitmap.c.o
>>    ../../block/qcow2-bitmap.c: In function 'qcow2_reopen_bitmaps_rw':
>>    ../../block/qcow2-bitmap.c:1211:60: error: incompatible type for argument 3 of 'g_slist_foreach'
>>     1211 |     g_slist_foreach(ro_dirty_bitmaps, set_readonly_helper, false);
>>          |                                                            ^~~~~
>>          |                                                            |
>>          |                                                            _Bool
>>    In file included from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/gmain.h:26,
>>                     from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/giochannel.h:33,
>>                     from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib.h:54,
>>                     from /Users/philmd/source/qemu/include/glib-compat.h:32,
>>                     from /Users/philmd/source/qemu/include/qemu/osdep.h:144,
>>                     from ../../block/qcow2-bitmap.c:28:
>>    /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/gslist.h:127:61: note: expected 'gpointer' {aka 'void *'} but argument is of type '_Bool'
>>      127 |                                           gpointer          user_data);
>>          |                                           ~~~~~~~~~~~~~~~~~~^~~~~~~~~
>>    At top level:
>>    FAILED: libblock.fa.p/block_qcow2-bitmap.c.o
>>
>> Fix by adding the missing gpointer cast.
>>
>> Fixes: 1b6b0562db ("qcow2: support .bdrv_reopen_bitmaps_rw")
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> 
> Thanks, applied to the block branch. And in case qemu-trivial picks it
> up anyway:
> 
> Reviewed-by: Kevin Wolf <kwolf@redhat.com>
> 
> 

It doesn't seem to be merged yet. Applied to my trivial-patches branch.

If you push it first I will remove it.

Thanks,
Laurent


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

end of thread, other threads:[~2022-09-29 19:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19 18:27 [PATCH] block/qcow2-bitmap: Add missing cast to silent GCC error Philippe Mathieu-Daudé via
2022-09-19 19:10 ` Vladimir Sementsov-Ogievskiy
2022-09-22 15:37 ` Kevin Wolf
2022-09-29 19:27   ` Laurent Vivier

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.