[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 34/34] nbd: assert that Error** is not NULL in nbd_iter_channel_er
From: |
Markus Armbruster |
Subject: |
[PULL 34/34] nbd: assert that Error** is not NULL in nbd_iter_channel_error |
Date: |
Tue, 17 Dec 2019 07:26:51 +0100 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
All callers of nbd_iter_channel_error() pass the address of a
local_err variable, and only call this function if an error has
already occurred, using this function to propagate that error.
This is already implied by its name (local_err instead of the classic
errp), but it is worth additionally stressing this by adding an
assertion to make it part of the function contract.
The local_err parameter is not here to return information about
nbd_iter_channel_error failure. Instead it's assumed to be filled when
passed to the function. This is already stressed by its name
(local_err, instead of classic errp). Stress it additionally by
assertion.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
block/nbd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/nbd.c b/block/nbd.c
index 5f18f78a94..d085554f21 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -866,6 +866,7 @@ typedef struct NBDReplyChunkIter {
static void nbd_iter_channel_error(NBDReplyChunkIter *iter,
int ret, Error **local_err)
{
+ assert(local_err && *local_err);
assert(ret < 0);
if (!iter->ret) {
--
2.21.0
- [PULL 29/34] hw/tpm: rename Error ** parameter to more common errp, (continued)
- [PULL 29/34] hw/tpm: rename Error ** parameter to more common errp, Markus Armbruster, 2019/12/17
- [PULL 10/34] qga: Fix guest-get-fsinfo error API violations, Markus Armbruster, 2019/12/17
- [PULL 06/34] exec: Fix file_ram_alloc() error API violations, Markus Armbruster, 2019/12/17
- [PULL 15/34] net/net: Clean up variable shadowing in net_client_init(), Markus Armbruster, 2019/12/17
- [PULL 16/34] error: make Error **errp const where it is appropriate, Markus Armbruster, 2019/12/17
- [PULL 28/34] hw/sd: drop extra whitespace in sdhci_sysbus_realize() header, Markus Armbruster, 2019/12/17
- [PULL 19/34] qdev-monitor: make Error **errp const where it is appropriate, Markus Armbruster, 2019/12/17
- [PULL 18/34] vnc: drop Error pointer indirection in vnc_client_io_error, Markus Armbruster, 2019/12/17
- [PULL 23/34] block/snapshot: rename Error ** parameter to more common errp, Markus Armbruster, 2019/12/17
- [PULL 32/34] backends/cryptodev: drop local_err from cryptodev_backend_complete(), Markus Armbruster, 2019/12/17
- [PULL 34/34] nbd: assert that Error** is not NULL in nbd_iter_channel_error,
Markus Armbruster <=
- [PULL 30/34] hw/usb: rename Error ** parameter to more common errp, Markus Armbruster, 2019/12/17
- [PULL 21/34] 9pfs: make Error **errp const where it is appropriate, Markus Armbruster, 2019/12/17
- [PULL 17/34] hmp: drop Error pointer indirection in hmp_handle_error, Markus Armbruster, 2019/12/17
- [PULL 27/34] hw/s390x: rename Error ** parameter to more common errp, Markus Armbruster, 2019/12/17
- [PULL 31/34] include/qom/object.h: rename Error ** parameter to more common errp, Markus Armbruster, 2019/12/17
- [PULL 24/34] hw/i386/amd_iommu: rename Error ** parameter to more common errp, Markus Armbruster, 2019/12/17
- [PULL 20/34] ppc: make Error **errp const where it is appropriate, Markus Armbruster, 2019/12/17