[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] block/block-copy: Fix uninitialized variable in block_co
From: |
Eric Blake |
Subject: |
Re: [PATCH 1/2] block/block-copy: Fix uninitialized variable in block_copy_task_entry |
Date: |
Thu, 7 May 2020 10:57:07 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
On 5/7/20 7:11 AM, Philippe Mathieu-Daudé wrote:
Fix when building with -Os:
CC block/block-copy.o
block/block-copy.c: In function ‘block_copy_task_entry’:
block/block-copy.c:428:38: error: ‘error_is_read’ may be used uninitialized
in this function [-Werror=maybe-uninitialized]
428 | t->call_state->error_is_read = error_is_read;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Looks like -Os triggered different inlining of block_copy_do_copy(). I
confirm that block_copy_do_copy does NOT initialize error_is_read except
when returning < 0, but similarly block_copy_task_entry() does not read
error_is_read except in the same setups. So it looks like no actual bug
was triggered, but we can definitely aid the compiler's analysis by
initializing.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
block/block-copy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org