All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: fix build waring
@ 2021-06-13  9:38 Zhiwei Jiang
  2021-06-13 15:03 ` Peter Maydell
  2021-06-14 18:39 ` Eric Blake
  0 siblings, 2 replies; 3+ messages in thread
From: Zhiwei Jiang @ 2021-06-13  9:38 UTC (permalink / raw)
  To: kwolf, mreitz, qemu-block, qemu-devel

when i compile this file with some error message
../block.c: In function ‘bdrv_replace_node_common’:
../block.c:4903:9: error: ‘to_cow_parent’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
         bdrv_remove_filter_or_cow_child(to_cow_parent, tran);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Zhiwei Jiang <elish.jiang@ucloud.cn>
---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block.c b/block.c
index 3f456892d0..08f29e6b65 100644
--- a/block.c
+++ b/block.c
@@ -4866,7 +4866,7 @@ static int bdrv_replace_node_common(BlockDriverState *from,
     Transaction *tran = tran_new();
     g_autoptr(GHashTable) found = NULL;
     g_autoptr(GSList) refresh_list = NULL;
-    BlockDriverState *to_cow_parent;
+    BlockDriverState *to_cow_parent = NULL;
     int ret;
 
     if (detach_subchain) {
-- 
2.25.1



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

* Re: [PATCH] block: fix build waring
  2021-06-13  9:38 [PATCH] block: fix build waring Zhiwei Jiang
@ 2021-06-13 15:03 ` Peter Maydell
  2021-06-14 18:39 ` Eric Blake
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2021-06-13 15:03 UTC (permalink / raw)
  To: Zhiwei Jiang; +Cc: Kevin Wolf, QEMU Developers, Qemu-block, Max Reitz

On Sun, 13 Jun 2021 at 15:20, Zhiwei Jiang <elish.jiang@ucloud.cn> wrote:
>
> when i compile this file with some error message
> ../block.c: In function ‘bdrv_replace_node_common’:
> ../block.c:4903:9: error: ‘to_cow_parent’ may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
>          bdrv_remove_filter_or_cow_child(to_cow_parent, tran);
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors


Could you provide the compiler version when reporting
fails-to-compile issues, please? (This is useful for us
to get an idea of whether the problem is an old compiler
that's not smart enough to figure out that something's not
used uninitialized, or a new compiler that does more checking.)

thanks
-- PMM


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

* Re: [PATCH] block: fix build waring
  2021-06-13  9:38 [PATCH] block: fix build waring Zhiwei Jiang
  2021-06-13 15:03 ` Peter Maydell
@ 2021-06-14 18:39 ` Eric Blake
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2021-06-14 18:39 UTC (permalink / raw)
  To: Zhiwei Jiang; +Cc: kwolf, qemu-devel, qemu-block, mreitz

On Sun, Jun 13, 2021 at 05:38:21PM +0800, Zhiwei Jiang wrote:

In the subject, s/waring/warning/

> when i compile this file with some error message
> ../block.c: In function ‘bdrv_replace_node_common’:
> ../block.c:4903:9: error: ‘to_cow_parent’ may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
>          bdrv_remove_filter_or_cow_child(to_cow_parent, tran);
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> Signed-off-by: Zhiwei Jiang <elish.jiang@ucloud.cn>
> ---
>  block.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

This looks identical to
https://lists.gnu.org/archive/html/qemu-devel/2021-05/msg01229.html
which has a more complete commit message and is already on Kevin's
tree for an upcoming pull request.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



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

end of thread, other threads:[~2021-06-14 18:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-13  9:38 [PATCH] block: fix build waring Zhiwei Jiang
2021-06-13 15:03 ` Peter Maydell
2021-06-14 18:39 ` Eric Blake

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.