[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 0/9] More truncate improvements
From: |
Eric Blake |
Subject: |
Re: [PATCH 0/9] More truncate improvements |
Date: |
Wed, 29 Apr 2020 08:14:47 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
On 4/28/20 9:24 PM, address@hidden wrote:
Patchew URL: https://patchew.org/QEMU/address@hidden/
/tmp/qemu-test/src/block/parallels.c: In function 'parallels_co_writev':
/tmp/qemu-test/src/block/parallels.c:218:12: error: 'ret' may be used
uninitialized in this function [-Werror=maybe-uninitialized]
if (ret < 0) {
^
/tmp/qemu-test/src/block/parallels.c:169:9: note: 'ret' was declared here
int ret;
^
False positive: the code is roughly:
int ret;
if (cond1) {
ret = ...;
}
if (cond2) {
ret = ...;
}
if (ret < 0)
but the compiler can't prove that cond1 + cond2 covers all
possibilities. The obvious fix is to initialize ret; squash this into 7/9:
diff --git i/block/parallels.c w/block/parallels.c
index eb6c6c01b998..e7717c508e62 100644
--- i/block/parallels.c
+++ w/block/parallels.c
@@ -166,7 +166,7 @@ static int64_t block_status(BDRVParallelsState *s,
int64_t sector_num,
static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
int nb_sectors, int *pnum)
{
- int ret;
+ int ret = 0;
BDRVParallelsState *s = bs->opaque;
int64_t pos, space, idx, to_allocate, i, len;
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
- [PATCH 1/9] gluster: Drop useless has_zero_init callback, (continued)
- [PATCH 1/9] gluster: Drop useless has_zero_init callback, Eric Blake, 2020/04/28
- [PATCH 4/9] rbd: Support BDRV_REQ_ZERO_WRITE for truncate, Eric Blake, 2020/04/28
- [PATCH 6/9] ssh: Support BDRV_REQ_ZERO_WRITE for truncate, Eric Blake, 2020/04/28
- [PATCH 5/9] sheepdog: Support BDRV_REQ_ZERO_WRITE for truncate, Eric Blake, 2020/04/28
- [PATCH 7/9] parallels: Rework truncation logic, Eric Blake, 2020/04/28
- [PATCH 8/9] vhdx: Rework truncation logic, Eric Blake, 2020/04/28
- [PATCH 9/9] block: Drop unused .bdrv_has_zero_init_truncate, Eric Blake, 2020/04/28
- Re: [PATCH 0/9] More truncate improvements, no-reply, 2020/04/28
- Re: [PATCH 0/9] More truncate improvements,
Eric Blake <=
- Re: [PATCH 0/9] More truncate improvements, no-reply, 2020/04/28