qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend()
@ 2024-03-11  3:37 Zhao Liu
  2024-03-11  3:37 ` [PATCH v2 01/29] error: Add error_vprepend() in comment of ERRP_GUARD() rules Zhao Liu
                   ` (29 more replies)
  0 siblings, 30 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:37 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu

From: Zhao Liu <zhao1.liu@intel.com>

Hi,

This series is the v2 to add missing ERRP_GUARD() for error_prepend(),
which collects the previous v1 part 1 [1] and v1 part 2 (and excludes
the 4 patches that have already been merged).

The @errp's second restriction (in qapi/error) said:

* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.

With this series, all error_prepend() will follow the above usage rules.

In this series, 2 cases of error_prepend() with &error_fatal are
recognized (patch 30 & patch 31).

And there are some remaining TODOs:
* follow-up cleanup for related @err use cases. (Suggested by Thomas)
* continue to cleanup error_append_hint().


The cleanup looks very trivial and thanks for your review!

[1]: https://lore.kernel.org/qemu-devel/20240228163723.1775791-1-zhao1.liu@linux.intel.com/
[2]: https://lore.kernel.org/qemu-devel/20240229143914.1977550-1-zhao1.liu@linux.intel.com/

Thanks and Best Regards,
Zhao

---
Zhao Liu (29):
  error: Add error_vprepend() in comment of ERRP_GUARD() rules
  backends/iommufd: Fix missing ERRP_GUARD() for error_prepend()
  block: Fix missing ERRP_GUARD() for error_prepend()
  block/copy-before-write: Fix missing ERRP_GUARD() for error_prepend()
  block/nbd: Fix missing ERRP_GUARD() for error_prepend()
  block/nvme: Fix missing ERRP_GUARD() for error_prepend()
  block/qcow2-bitmap: Fix missing ERRP_GUARD() for error_prepend()
  block/qcow2: Fix missing ERRP_GUARD() for error_prepend()
  block/qed: Fix missing ERRP_GUARD() for error_prepend()
  block/snapshot: Fix missing ERRP_GUARD() for error_prepend()
  block/vdi: Fix missing ERRP_GUARD() for error_prepend()
  block/vmdk: Fix missing ERRP_GUARD() for error_prepend()
  block/virtio-blk: Fix missing ERRP_GUARD() for error_prepend()
  hw/core/loader-fit: Fix missing ERRP_GUARD() for error_prepend()
  hw/core/qdev-properties-system: Fix missing ERRP_GUARD() for
    error_prepend()
  hw/misc/ivshmem: Fix missing ERRP_GUARD() for error_prepend()
  hw/scsi/vhost-scsi: Fix missing ERRP_GUARD() for error_prepend()
  hw/vfio/ap: Fix missing ERRP_GUARD() for error_prepend()
  hw/vfio/container: Fix missing ERRP_GUARD() for error_prepend()
  hw/vfio/helpers: Fix missing ERRP_GUARD() for error_prepend()
  hw/vfio/iommufd: Fix missing ERRP_GUARD() for error_prepend()
  hw/vfio/pci-quirks: Fix missing ERRP_GUARD() for error_prepend()
  hw/vfio/pci: Fix missing ERRP_GUARD() for error_prepend()
  hw/vfio/platform: Fix missing ERRP_GUARD() for error_prepend()
  hw/virtio/vhost-vsock: Fix missing ERRP_GUARD() for error_prepend()
  hw/virtio/vhost: Fix missing ERRP_GUARD() for error_prepend()
  migration/option: Fix missing ERRP_GUARD() for error_prepend()
  net/vhost-vdpa: Fix missing ERRP_GUARD() for error_prepend()
  target/s390x/cpu_models: Fix missing ERRP_GUARD() for error_prepend()

 backends/iommufd.c               | 1 +
 block.c                          | 4 ++++
 block/copy-before-write.c        | 1 +
 block/nbd.c                      | 1 +
 block/nvme.c                     | 3 +++
 block/qcow2-bitmap.c             | 1 +
 block/qcow2.c                    | 2 ++
 block/qed.c                      | 1 +
 block/snapshot.c                 | 2 ++
 block/vdi.c                      | 1 +
 block/vmdk.c                     | 1 +
 hw/block/virtio-blk.c            | 1 +
 hw/core/loader-fit.c             | 2 ++
 hw/core/qdev-properties-system.c | 1 +
 hw/misc/ivshmem.c                | 1 +
 hw/scsi/vhost-scsi.c             | 1 +
 hw/vfio/ap.c                     | 1 +
 hw/vfio/container.c              | 1 +
 hw/vfio/helpers.c                | 3 +++
 hw/vfio/iommufd.c                | 1 +
 hw/vfio/pci-quirks.c             | 2 ++
 hw/vfio/pci.c                    | 2 ++
 hw/vfio/platform.c               | 1 +
 hw/virtio/vhost-vsock.c          | 1 +
 hw/virtio/vhost.c                | 2 ++
 include/qapi/error.h             | 2 +-
 migration/options.c              | 2 ++
 net/vhost-vdpa.c                 | 1 +
 target/s390x/cpu_models.c        | 2 ++
 29 files changed, 44 insertions(+), 1 deletion(-)

-- 
2.34.1



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

* [PATCH v2 01/29] error: Add error_vprepend() in comment of ERRP_GUARD() rules
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
@ 2024-03-11  3:37 ` Zhao Liu
  2024-03-11  3:37 ` [PATCH v2 02/29] backends/iommufd: Fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (28 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:37 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu

From: Zhao Liu <zhao1.liu@intel.com>

The error_vprepend() should use ERRP_GUARD() just as the documentation
of ERRP_GUARD() says:

> It must be used when the function dereferences @errp or passes
> @errp to error_prepend(), error_vprepend(), or error_append_hint().

Considering that error_vprepend() is also an API provided in error.h,
it is necessary to add it to the description of the rules for using
ERRP_GUARD().

Cc: Markus Armbruster <armbru@redhat.com>
Cc: Michael Roth <michael.roth@amd.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
v2: Add a comma after error_vprepend(). (Markus)
---
 include/qapi/error.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/qapi/error.h b/include/qapi/error.h
index f21a231bb1a6..71f8fb2c50ee 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -207,7 +207,7 @@
  *
  * Without ERRP_GUARD(), use of the @errp parameter is restricted:
  * - It must not be dereferenced, because it may be null.
- * - It should not be passed to error_prepend() or
+ * - It should not be passed to error_prepend(), error_vprepend(), or
  *   error_append_hint(), because that doesn't work with &error_fatal.
  * ERRP_GUARD() lifts these restrictions.
  *
-- 
2.34.1



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

* [PATCH v2 02/29] backends/iommufd: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
  2024-03-11  3:37 ` [PATCH v2 01/29] error: Add error_vprepend() in comment of ERRP_GUARD() rules Zhao Liu
@ 2024-03-11  3:37 ` Zhao Liu
  2024-03-11  9:32   ` Eric Auger
  2024-03-11  3:37 ` [PATCH v2 03/29] block: " Zhao Liu
                   ` (27 subsequent siblings)
  29 siblings, 1 reply; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:37 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Yi Liu, Eric Auger, Zhenzhong Duan

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The iommufd_backend_set_fd() passes @errp to error_prepend(), to avoid
the above issue, add missing ERRP_GUARD() at the beginning of this
function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Yi Liu <yi.l.liu@intel.com>
Cc: Eric Auger <eric.auger@redhat.com>
Cc: Zhenzhong Duan <zhenzhong.duan@intel.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 backends/iommufd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/backends/iommufd.c b/backends/iommufd.c
index 1ef683c7b080..62a79fa6b049 100644
--- a/backends/iommufd.c
+++ b/backends/iommufd.c
@@ -43,6 +43,7 @@ static void iommufd_backend_finalize(Object *obj)
 
 static void iommufd_backend_set_fd(Object *obj, const char *str, Error **errp)
 {
+    ERRP_GUARD();
     IOMMUFDBackend *be = IOMMUFD_BACKEND(obj);
     int fd = -1;
 
-- 
2.34.1



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

* [PATCH v2 03/29] block: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
  2024-03-11  3:37 ` [PATCH v2 01/29] error: Add error_vprepend() in comment of ERRP_GUARD() rules Zhao Liu
  2024-03-11  3:37 ` [PATCH v2 02/29] backends/iommufd: Fix missing ERRP_GUARD() for error_prepend() Zhao Liu
@ 2024-03-11  3:37 ` Zhao Liu
  2024-03-11  3:37 ` [PATCH v2 04/29] block/copy-before-write: " Zhao Liu
                   ` (26 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:37 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Kevin Wolf, Hanna Reitz, qemu-block,
	Eric Blake

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

In block.c, there are 4 functions passing @errp to error_prepend()
without ERRP_GUARD():
 - bdrv_co_create_opts_simple()
 - parse_json_filename()
 - bdrv_open_backing_file()
 - bdrv_append_temp_snapshot()

bdrv_co_create_opts_simple(), is an implementation of
BlockDriver.bdrv_co_create_opts(). There are too many possible callers
to check the impact of this defect; it may or may not be harmless. Thus
it is necessary to protect @errp with ERRP_GUARD().

Though the @errp parameters passed to parse_json_filename(),
bdrv_open_backing_file() and bdrv_append_temp_snapshot() points to their
callers' local_err, to follow the requirement of @errp, also add missing
ERRP_GUARD() at their beginning.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
v2:
 * Use Markus' sentence to polish commit message. (Markus)
 * Fix typo. (Eric)
---
 block.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/block.c b/block.c
index 1ed9214f66ed..cf66c767a011 100644
--- a/block.c
+++ b/block.c
@@ -633,6 +633,7 @@ int coroutine_fn bdrv_co_create_opts_simple(BlockDriver *drv,
                                             QemuOpts *opts,
                                             Error **errp)
 {
+    ERRP_GUARD();
     BlockBackend *blk;
     QDict *options;
     int64_t size = 0;
@@ -1998,6 +1999,7 @@ fail_opts:
 
 static QDict *parse_json_filename(const char *filename, Error **errp)
 {
+    ERRP_GUARD();
     QObject *options_obj;
     QDict *options;
     int ret;
@@ -3585,6 +3587,7 @@ int bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd,
 int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
                            const char *bdref_key, Error **errp)
 {
+    ERRP_GUARD();
     char *backing_filename = NULL;
     char *bdref_key_dot;
     const char *reference = NULL;
@@ -3851,6 +3854,7 @@ static BlockDriverState *bdrv_append_temp_snapshot(BlockDriverState *bs,
                                                    QDict *snapshot_options,
                                                    Error **errp)
 {
+    ERRP_GUARD();
     g_autofree char *tmp_filename = NULL;
     int64_t total_size;
     QemuOpts *opts = NULL;
-- 
2.34.1



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

* [PATCH v2 04/29] block/copy-before-write: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (2 preceding siblings ...)
  2024-03-11  3:37 ` [PATCH v2 03/29] block: " Zhao Liu
@ 2024-03-11  3:37 ` Zhao Liu
  2024-03-11  3:37 ` [PATCH v2 05/29] block/nbd: " Zhao Liu
                   ` (25 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:37 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, John Snow, Vladimir Sementsov-Ogievskiy,
	Kevin Wolf, Hanna Reitz, qemu-block

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The cbw_open() passes @errp to error_prepend() without ERRP_GUARD().

Though it is the BlockDriver.bdrv_open() method, and currently its
@errp parameter only points to callers' local_err, to follow the
requirement of @errp, add missing ERRP_GUARD() at the beginning of this
function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: John Snow <jsnow@redhat.com>
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
 block/copy-before-write.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/copy-before-write.c b/block/copy-before-write.c
index 0842a1a6dfbe..8aba27a71d6d 100644
--- a/block/copy-before-write.c
+++ b/block/copy-before-write.c
@@ -407,6 +407,7 @@ out:
 static int cbw_open(BlockDriverState *bs, QDict *options, int flags,
                     Error **errp)
 {
+    ERRP_GUARD();
     BDRVCopyBeforeWriteState *s = bs->opaque;
     BdrvDirtyBitmap *bitmap = NULL;
     int64_t cluster_size;
-- 
2.34.1



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

* [PATCH v2 05/29] block/nbd: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (3 preceding siblings ...)
  2024-03-11  3:37 ` [PATCH v2 04/29] block/copy-before-write: " Zhao Liu
@ 2024-03-11  3:37 ` Zhao Liu
  2024-03-11  3:37 ` [PATCH v2 06/29] block/nvme: " Zhao Liu
                   ` (24 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:37 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Eric Blake, Vladimir Sementsov-Ogievskiy,
	Kevin Wolf, Hanna Reitz, qemu-block

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The nbd_co_do_receive_one_chunk() passes @errp to error_prepend()
without ERRP_GUARD(), and though its @errp parameter points to its
caller's local_err, to follow the requirement of @errp, add missing
ERRP_GUARD() at the beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Eric Blake <eblake@redhat.com>
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
 block/nbd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/nbd.c b/block/nbd.c
index b9d4f935e017..ef05f7cdfd65 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -852,6 +852,7 @@ static coroutine_fn int nbd_co_do_receive_one_chunk(
         BDRVNBDState *s, uint64_t cookie, bool only_structured,
         int *request_ret, QEMUIOVector *qiov, void **payload, Error **errp)
 {
+    ERRP_GUARD();
     int ret;
     int i = COOKIE_TO_INDEX(cookie);
     void *local_payload = NULL;
-- 
2.34.1



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

* [PATCH v2 06/29] block/nvme: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (4 preceding siblings ...)
  2024-03-11  3:37 ` [PATCH v2 05/29] block/nbd: " Zhao Liu
@ 2024-03-11  3:37 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 07/29] block/qcow2-bitmap: " Zhao Liu
                   ` (23 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:37 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Stefan Hajnoczi, Fam Zheng, Kevin Wolf,
	Hanna Reitz, qemu-block

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

In nvme.c, there are 3 functions passing @errp to error_prepend()
without ERRP_GUARD():
- nvme_init_queue()
- nvme_create_queue_pair()
- nvme_identify()

All these 3 functions take their @errp parameters from the
nvme_file_open(), which is a BlockDriver.bdrv_nvme() method and its
@errp points to its caller's local_err.

Though these 3 cases haven't trigger the issue like [1] said, to
follow the requirement of @errp, add missing ERRP_GUARD() at their
beginning.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Fam Zheng <fam@euphon.net>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/nvme.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/nvme.c b/block/nvme.c
index 0a0a0a6b36cd..3a3c6da73d29 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -168,6 +168,7 @@ static QemuOptsList runtime_opts = {
 static bool nvme_init_queue(BDRVNVMeState *s, NVMeQueue *q,
                             unsigned nentries, size_t entry_bytes, Error **errp)
 {
+    ERRP_GUARD();
     size_t bytes;
     int r;
 
@@ -221,6 +222,7 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeState *s,
                                              unsigned idx, size_t size,
                                              Error **errp)
 {
+    ERRP_GUARD();
     int i, r;
     NVMeQueuePair *q;
     uint64_t prp_list_iova;
@@ -535,6 +537,7 @@ static int nvme_admin_cmd_sync(BlockDriverState *bs, NvmeCmd *cmd)
 /* Returns true on success, false on failure. */
 static bool nvme_identify(BlockDriverState *bs, int namespace, Error **errp)
 {
+    ERRP_GUARD();
     BDRVNVMeState *s = bs->opaque;
     bool ret = false;
     QEMU_AUTO_VFREE union {
-- 
2.34.1



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

* [PATCH v2 07/29] block/qcow2-bitmap: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (5 preceding siblings ...)
  2024-03-11  3:37 ` [PATCH v2 06/29] block/nvme: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 08/29] block/qcow2: " Zhao Liu
                   ` (22 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Kevin Wolf, Hanna Reitz, Eric Blake,
	Vladimir Sementsov-Ogievskiy, John Snow, qemu-block

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The qcow2_co_can_store_new_dirty_bitmap() passes @errp to
error_prepend(). As a BlockDriver.bdrv_co_can_store_new_dirty_bitmap
method, it's called by bdrv_co_can_store_new_dirty_bitmap().

Its caller is not being called anywhere, but as the API in
include/block/block-io.h, we can't ensure what kind of @errp future
users will pass in.

To avoid potential issues as [1] said, add missing ERRP_GUARD() at the
beginning of qcow2_co_can_store_new_dirty_bitmap().

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: John Snow <jsnow@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
 block/qcow2-bitmap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
index 0e567ed588d7..874ea5694851 100644
--- a/block/qcow2-bitmap.c
+++ b/block/qcow2-bitmap.c
@@ -1710,6 +1710,7 @@ bool coroutine_fn qcow2_co_can_store_new_dirty_bitmap(BlockDriverState *bs,
                                                       uint32_t granularity,
                                                       Error **errp)
 {
+    ERRP_GUARD();
     BDRVQcow2State *s = bs->opaque;
     BdrvDirtyBitmap *bitmap;
     uint64_t bitmap_directory_size = 0;
-- 
2.34.1



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

* [PATCH v2 08/29] block/qcow2: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (6 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 07/29] block/qcow2-bitmap: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 09/29] block/qed: " Zhao Liu
                   ` (21 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Kevin Wolf, Hanna Reitz, qemu-block,
	Eric Blake

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

In block/qcow2.c, there are 2 functions passing @errp to error_prepend()
without ERRP_GUARD():
 - qcow2_co_create()
 - qcow2_co_truncate()

There are too many possible callers to check the impact of the defect;
it may or may not be harmless. Thus it is necessary to protect @errp with
ERRP_GUARD().

Therefore, to avoid the issue like [1] said, add missing ERRP_GUARD() at
their beginning.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
v2:
 * Use Markus' sentence to polish commit message. (Markus)
 * Fix typo. (Eric)
---
 block/qcow2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/qcow2.c b/block/qcow2.c
index 204f5854cff2..956128b40948 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -3483,6 +3483,7 @@ static uint64_t qcow2_opt_get_refcount_bits_del(QemuOpts *opts, int version,
 static int coroutine_fn GRAPH_UNLOCKED
 qcow2_co_create(BlockdevCreateOptions *create_options, Error **errp)
 {
+    ERRP_GUARD();
     BlockdevCreateOptionsQcow2 *qcow2_opts;
     QDict *options;
 
@@ -4283,6 +4284,7 @@ static int coroutine_fn GRAPH_RDLOCK
 qcow2_co_truncate(BlockDriverState *bs, int64_t offset, bool exact,
                   PreallocMode prealloc, BdrvRequestFlags flags, Error **errp)
 {
+    ERRP_GUARD();
     BDRVQcow2State *s = bs->opaque;
     uint64_t old_length;
     int64_t new_l1_size;
-- 
2.34.1



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

* [PATCH v2 09/29] block/qed: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (7 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 08/29] block/qcow2: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 10/29] block/snapshot: " Zhao Liu
                   ` (20 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Stefan Hajnoczi, Kevin Wolf, Hanna Reitz,
	qemu-block

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The bdrv_qed_co_invalidate_cache() passes @errp to error_prepend()
without ERRP_GUARD().

Though it is a BlockDriver.bdrv_co_invalidate_cache() method, and
currently its @errp parameter only points to callers' local_err, to
follow the requirement of @errp, add missing ERRP_GUARD() at the
beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/qed.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/qed.c b/block/qed.c
index bc2f0a61c0a9..fa5bc1108552 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -1579,6 +1579,7 @@ bdrv_qed_co_change_backing_file(BlockDriverState *bs, const char *backing_file,
 static void coroutine_fn GRAPH_RDLOCK
 bdrv_qed_co_invalidate_cache(BlockDriverState *bs, Error **errp)
 {
+    ERRP_GUARD();
     BDRVQEDState *s = bs->opaque;
     int ret;
 
-- 
2.34.1



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

* [PATCH v2 10/29] block/snapshot: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (8 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 09/29] block/qed: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-12  8:11   ` Thomas Huth
  2024-03-11  3:38 ` [PATCH v2 11/29] block/vdi: " Zhao Liu
                   ` (19 subsequent siblings)
  29 siblings, 1 reply; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Kevin Wolf, Hanna Reitz, qemu-block

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

In block/snapshot.c, there are 2 functions passing @errp to
error_prepend() without ERRP_GUARD():
 - bdrv_all_delete_snapshot()
 - bdrv_all_goto_snapshot()

As the APIs exposed in include/block/snapshot.h, they could be called
by other modules.

To avoid potential issues as [1] said, add missing ERRP_GUARD() at the
beginning of these 2 functions.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 block/snapshot.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/snapshot.c b/block/snapshot.c
index 8694fc0a3eba..8242b4abac41 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -566,6 +566,7 @@ int bdrv_all_delete_snapshot(const char *name,
                              bool has_devices, strList *devices,
                              Error **errp)
 {
+    ERRP_GUARD();
     g_autoptr(GList) bdrvs = NULL;
     GList *iterbdrvs;
 
@@ -605,6 +606,7 @@ int bdrv_all_goto_snapshot(const char *name,
                            bool has_devices, strList *devices,
                            Error **errp)
 {
+    ERRP_GUARD();
     g_autoptr(GList) bdrvs = NULL;
     GList *iterbdrvs;
     int ret;
-- 
2.34.1



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

* [PATCH v2 11/29] block/vdi: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (9 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 10/29] block/snapshot: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-12  8:14   ` Thomas Huth
  2024-03-11  3:38 ` [PATCH v2 12/29] block/vmdk: " Zhao Liu
                   ` (18 subsequent siblings)
  29 siblings, 1 reply; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Stefan Weil, Kevin Wolf, Hanna Reitz,
	qemu-block

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The vdi_co_do_create() passes @errp to error_prepend() without
ERRP_GUARD(), and its @errp parameter is so widely sourced that it is
necessary to protect it with ERRP_GUARD().

To avoid the potential issues as [1] said, add missing ERRP_GUARD() at
the beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Stefan Weil <sw@weilnetz.de>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 block/vdi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/vdi.c b/block/vdi.c
index 3b57becb9fe0..6363da08cee9 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -738,6 +738,7 @@ static int coroutine_fn GRAPH_UNLOCKED
 vdi_co_do_create(BlockdevCreateOptions *create_options, size_t block_size,
                  Error **errp)
 {
+    ERRP_GUARD();
     BlockdevCreateOptionsVdi *vdi_opts;
     int ret = 0;
     uint64_t bytes = 0;
-- 
2.34.1



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

* [PATCH v2 12/29] block/vmdk: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (10 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 11/29] block/vdi: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-12  8:23   ` Thomas Huth
  2024-03-11  3:38 ` [PATCH v2 13/29] block/virtio-blk: " Zhao Liu
                   ` (17 subsequent siblings)
  29 siblings, 1 reply; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Fam Zheng, Kevin Wolf, Hanna Reitz,
	qemu-block

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The vmdk_parse_extents() passes @errp to error_prepend(), and its @errp
is from vmdk_open().

Though, vmdk_open(), as a BlockDriver.bdrv_open(), gets the @errp
parameter which is pointer of its caller's local_err, to follow the
requirement of @errp, add missing ERRP_GUARD() at the beginning of this
function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Fam Zheng <fam@euphon.net>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 block/vmdk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/vmdk.c b/block/vmdk.c
index bf78e1238351..3b82979fdf42 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1147,6 +1147,7 @@ static int GRAPH_RDLOCK
 vmdk_parse_extents(const char *desc, BlockDriverState *bs, QDict *options,
                    Error **errp)
 {
+    ERRP_GUARD();
     int ret;
     int matches;
     char access[11];
-- 
2.34.1



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

* [PATCH v2 13/29] block/virtio-blk: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (11 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 12/29] block/vmdk: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 14/29] hw/core/loader-fit: " Zhao Liu
                   ` (16 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Stefan Hajnoczi, Michael S. Tsirkin,
	Kevin Wolf, Hanna Reitz, qemu-block

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The virtio_blk_vq_aio_context_init() passes @errp to error_prepend().

Though its @errp points its caller's local @err variable, to follow the
requirement of @errp, add missing ERRP_GUARD() at the beginning of
virtio_blk_vq_aio_context_init().

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/block/virtio-blk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 738cb2ac367d..92de315f17f7 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -1682,6 +1682,7 @@ static bool apply_iothread_vq_mapping(
 /* Context: BQL held */
 static bool virtio_blk_vq_aio_context_init(VirtIOBlock *s, Error **errp)
 {
+    ERRP_GUARD();
     VirtIODevice *vdev = VIRTIO_DEVICE(s);
     VirtIOBlkConf *conf = &s->conf;
     BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
-- 
2.34.1



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

* [PATCH v2 14/29] hw/core/loader-fit: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (12 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 13/29] block/virtio-blk: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 15/29] hw/core/qdev-properties-system: " Zhao Liu
                   ` (15 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Paul Burton, Aleksandar Rikalo

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

In hw/core/loader-fit.c, there are 2 functions passing @errp to
error_prepend() without ERRP_GUARD():
 - fit_load_kernel()
 - fit_load_fdt()

Their @errp parameters are both the pointers of the local @err virable
in load_fit().

Though they don't cause the issue like [1] said, to follow the
requirement of @errp, add missing ERRP_GUARD() at their beginning.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Paul Burton <paulburton@kernel.org>
Cc: Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 hw/core/loader-fit.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/core/loader-fit.c b/hw/core/loader-fit.c
index b7c7b3ba94d4..9f20007dbb51 100644
--- a/hw/core/loader-fit.c
+++ b/hw/core/loader-fit.c
@@ -120,6 +120,7 @@ static int fit_load_kernel(const struct fit_loader *ldr, const void *itb,
                            int cfg, void *opaque, hwaddr *pend,
                            Error **errp)
 {
+    ERRP_GUARD();
     const char *name;
     const void *data;
     const void *load_data;
@@ -178,6 +179,7 @@ static int fit_load_fdt(const struct fit_loader *ldr, const void *itb,
                         int cfg, void *opaque, const void *match_data,
                         hwaddr kernel_end, Error **errp)
 {
+    ERRP_GUARD();
     Error *err = NULL;
     const char *name;
     const void *data;
-- 
2.34.1



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

* [PATCH v2 15/29] hw/core/qdev-properties-system: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (13 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 14/29] hw/core/loader-fit: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 16/29] hw/misc/ivshmem: " Zhao Liu
                   ` (14 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Paolo Bonzini, Eduardo Habkost

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The set_chr() passes @errp to error_prepend() without ERRP_GUARD().

As a PropertyInfo.set method, there are too many possible callers to
check the impact of this defect; it may or may not be harmless. Thus it
is necessary to protect @errp with ERRP_GUARD().

To avoid the issue like [1] said, add missing ERRP_GUARD() at the
beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com
Cc: Eduardo Habkost <eduardo@habkost.net>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
v2: Use Markus' sentence to polish commit message. (Markus)
---
 hw/core/qdev-properties-system.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index b45e90edb2a2..00c968f4f52b 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -242,6 +242,7 @@ static void get_chr(Object *obj, Visitor *v, const char *name, void *opaque,
 static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
                     Error **errp)
 {
+    ERRP_GUARD();
     Property *prop = opaque;
     CharBackend *be = object_field_prop_ptr(obj, prop);
     Chardev *s;
-- 
2.34.1



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

* [PATCH v2 16/29] hw/misc/ivshmem: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (14 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 15/29] hw/core/qdev-properties-system: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 17/29] hw/scsi/vhost-scsi: " Zhao Liu
                   ` (13 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Juan Quintela, Manos Pitsidianakis,
	Michael Galaxy, Steve Sistare

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The ivshmem_common_realize() passes @errp to error_prepend(), and as a
DeviceClass.realize method, there are too many possible callers to check
the impact of this defect; it may or may not be harmless. Thus it is
necessary to protect @errp with ERRP_GUARD().

To avoid the issue like [1] said, add missing ERRP_GUARD() at the
beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Juan Quintela <quintela@trasno.org>
Cc: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Cc: Michael Galaxy <mgalaxy@akamai.com>
Cc: Steve Sistare <steven.sistare@oracle.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
v2: Use Markus' sentence to polish commit message. (Markus)
---
 hw/misc/ivshmem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index a2fd0bc36544..de49d1b8a826 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -832,6 +832,7 @@ static void ivshmem_write_config(PCIDevice *pdev, uint32_t address,
 
 static void ivshmem_common_realize(PCIDevice *dev, Error **errp)
 {
+    ERRP_GUARD();
     IVShmemState *s = IVSHMEM_COMMON(dev);
     Error *err = NULL;
     uint8_t *pci_conf;
-- 
2.34.1



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

* [PATCH v2 17/29] hw/scsi/vhost-scsi: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (15 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 16/29] hw/misc/ivshmem: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-12  8:48   ` Thomas Huth
  2024-03-11  3:38 ` [PATCH v2 18/29] hw/vfio/ap: " Zhao Liu
                   ` (12 subsequent siblings)
  29 siblings, 1 reply; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Paolo Bonzini, Fam Zheng,
	Michael S. Tsirkin

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The vhost_scsi_realize() passes @errp to error_prepend(), and as a
VirtioDeviceClass.realize method, its @errp is from DeviceClass.realize
so that there is no guarantee that the @errp won't point to
@error_fatal.

To avoid the issue like [1] said, add missing ERRP_GUARD() at the
beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Fam Zheng <fam@euphon.net>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 hw/scsi/vhost-scsi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
index 58a00336c2db..ae26bc19a457 100644
--- a/hw/scsi/vhost-scsi.c
+++ b/hw/scsi/vhost-scsi.c
@@ -220,6 +220,7 @@ static int vhost_scsi_set_workers(VHostSCSICommon *vsc, bool per_virtqueue)
 
 static void vhost_scsi_realize(DeviceState *dev, Error **errp)
 {
+    ERRP_GUARD();
     VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev);
     VHostSCSICommon *vsc = VHOST_SCSI_COMMON(dev);
     Error *err = NULL;
-- 
2.34.1



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

* [PATCH v2 18/29] hw/vfio/ap: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (16 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 17/29] hw/scsi/vhost-scsi: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  7:42   ` Cédric Le Goater
  2024-03-11  3:38 ` [PATCH v2 19/29] hw/vfio/container: " Zhao Liu
                   ` (11 subsequent siblings)
  29 siblings, 1 reply; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Alex Williamson, Cédric Le Goater,
	Tony Krowiak, Halil Pasic, Jason Herne, qemu-s390x

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The vfio_ap_realize() passes @errp to error_prepend(), and as a
DeviceClass.realize method, there are too many possible callers to check
the impact of this defect; it may or may not be harmless. Thus it is
necessary to protect @errp with ERRP_GUARD().

To avoid the issue like [1] said, add missing ERRP_GUARD() at the
beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: "Cédric Le Goater" <clg@redhat.com>
Cc: Tony Krowiak <akrowiak@linux.ibm.com>
Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Jason Herne <jjherne@linux.ibm.com>
Cc: Thomas Huth <thuth@redhat.com>
Cc: qemu-s390x@nongnu.org
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
v2: Use Markus' sentence to polish commit message. (Markus)
---
 hw/vfio/ap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
index e157aa1ff79c..7c4caa593863 100644
--- a/hw/vfio/ap.c
+++ b/hw/vfio/ap.c
@@ -155,6 +155,7 @@ static void vfio_ap_unregister_irq_notifier(VFIOAPDevice *vapdev,
 
 static void vfio_ap_realize(DeviceState *dev, Error **errp)
 {
+    ERRP_GUARD();
     int ret;
     Error *err = NULL;
     VFIOAPDevice *vapdev = VFIO_AP_DEVICE(dev);
-- 
2.34.1



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

* [PATCH v2 19/29] hw/vfio/container: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (17 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 18/29] hw/vfio/ap: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 20/29] hw/vfio/helpers: " Zhao Liu
                   ` (10 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Alex Williamson, Cédric Le Goater

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The vfio_get_group() passes @errp to error_prepend(). Its @errp is
from vfio_attach_device(), and there are too many possible callers to
check the impact of this defect; it may or may not be harmless. Thus it
is necessary to protect @errp with ERRP_GUARD().

To avoid the issue like [1] said, add missing ERRP_GUARD() at the
beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: "Cédric Le Goater" <clg@redhat.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
---
v2: Use Markus' sentence to polish commit message. (Markus)
---
 hw/vfio/container.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index bd25b9fbad2e..f66bb01f5b18 100644
--- a/hw/vfio/container.c
+++ b/hw/vfio/container.c
@@ -719,6 +719,7 @@ static void vfio_disconnect_container(VFIOGroup *group)
 
 static VFIOGroup *vfio_get_group(int groupid, AddressSpace *as, Error **errp)
 {
+    ERRP_GUARD();
     VFIOGroup *group;
     char path[32];
     struct vfio_group_status status = { .argsz = sizeof(status) };
-- 
2.34.1



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

* [PATCH v2 20/29] hw/vfio/helpers: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (18 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 19/29] hw/vfio/container: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 21/29] hw/vfio/iommufd: " Zhao Liu
                   ` (9 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Alex Williamson, Cédric Le Goater

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

In hw/vfio/helpers.c, there are 3 functions passing @errp to
error_prepend() without ERRP_GUARD():
 - vfio_set_irq_signaling()
 - vfio_device_get_name()
 - vfio_device_set_fd()

There are too many possible callers to check the impact of this defect;
it may or may not be harmless. Thus it is necessary to protect their
@errp with ERRP_GUARD().

To avoid the issue like [1] said, add missing ERRP_GUARD() at their
beginning.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: "Cédric Le Goater" <clg@redhat.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
---
v2: Use Markus' sentence to polish commit message. (Markus)
---
 hw/vfio/helpers.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/vfio/helpers.c b/hw/vfio/helpers.c
index 678987080228..47b4096c05ee 100644
--- a/hw/vfio/helpers.c
+++ b/hw/vfio/helpers.c
@@ -110,6 +110,7 @@ static const char *index_to_str(VFIODevice *vbasedev, int index)
 int vfio_set_irq_signaling(VFIODevice *vbasedev, int index, int subindex,
                            int action, int fd, Error **errp)
 {
+    ERRP_GUARD();
     struct vfio_irq_set *irq_set;
     int argsz, ret = 0;
     const char *name;
@@ -613,6 +614,7 @@ bool vfio_has_region_cap(VFIODevice *vbasedev, int region, uint16_t cap_type)
 
 int vfio_device_get_name(VFIODevice *vbasedev, Error **errp)
 {
+    ERRP_GUARD();
     struct stat st;
 
     if (vbasedev->fd < 0) {
@@ -644,6 +646,7 @@ int vfio_device_get_name(VFIODevice *vbasedev, Error **errp)
 
 void vfio_device_set_fd(VFIODevice *vbasedev, const char *str, Error **errp)
 {
+    ERRP_GUARD();
     int fd = monitor_fd_param(monitor_cur(), str, errp);
 
     if (fd < 0) {
-- 
2.34.1



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

* [PATCH v2 21/29] hw/vfio/iommufd: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (19 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 20/29] hw/vfio/helpers: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 22/29] hw/vfio/pci-quirks: " Zhao Liu
                   ` (8 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Alex Williamson, Cédric Le Goater

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The iommufd_cdev_getfd() passes @errp to error_prepend(). Its @errp is
from vfio_attach_device(), and there are too many possible callers to
check the impact of this defect; it may or may not be harmless. Thus it
is necessary to protect @errp with ERRP_GUARD().

To avoid the issue like [1] said, add missing ERRP_GUARD() at the
beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: "Cédric Le Goater" <clg@redhat.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
---
v2: Use Markus' sentence to polish commit message. (Markus)
---
 hw/vfio/iommufd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index 9bfddc136089..7baf49e6ee9e 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -116,6 +116,7 @@ static void iommufd_cdev_unbind_and_disconnect(VFIODevice *vbasedev)
 
 static int iommufd_cdev_getfd(const char *sysfs_path, Error **errp)
 {
+    ERRP_GUARD();
     long int ret = -ENOTTY;
     char *path, *vfio_dev_path = NULL, *vfio_path = NULL;
     DIR *dir = NULL;
-- 
2.34.1



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

* [PATCH v2 22/29] hw/vfio/pci-quirks: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (20 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 21/29] hw/vfio/iommufd: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 23/29] hw/vfio/pci: " Zhao Liu
                   ` (7 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Alex Williamson, Cédric Le Goater

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

In hw/vfio/pci-quirks.c, there are 2 functions passing @errp to
error_prepend() without ERRP_GUARD():
- vfio_add_nv_gpudirect_cap()
- vfio_add_vmd_shadow_cap()

There are too many possible callers to check the impact of this defect;
it may or may not be harmless. Thus it is necessary to protect their
@errp with ERRP_GUARD().

To avoid the issue like [1] said, add missing ERRP_GUARD() at the
beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: "Cédric Le Goater" <clg@redhat.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
---
v2: Use Markus' sentence to polish commit message. (Markus)
---
 hw/vfio/pci-quirks.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
index 84b1a7b9485c..496fd1ee86bd 100644
--- a/hw/vfio/pci-quirks.c
+++ b/hw/vfio/pci-quirks.c
@@ -1538,6 +1538,7 @@ static bool is_valid_std_cap_offset(uint8_t pos)
 
 static int vfio_add_nv_gpudirect_cap(VFIOPCIDevice *vdev, Error **errp)
 {
+    ERRP_GUARD();
     PCIDevice *pdev = &vdev->pdev;
     int ret, pos;
     bool c8_conflict = false, d4_conflict = false;
@@ -1630,6 +1631,7 @@ static int vfio_add_nv_gpudirect_cap(VFIOPCIDevice *vdev, Error **errp)
 #define VMD_SHADOW_CAP_LEN 24
 static int vfio_add_vmd_shadow_cap(VFIOPCIDevice *vdev, Error **errp)
 {
+    ERRP_GUARD();
     uint8_t membar_phys[16];
     int ret, pos = 0xE8;
 
-- 
2.34.1



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

* [PATCH v2 23/29] hw/vfio/pci: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (21 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 22/29] hw/vfio/pci-quirks: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 24/29] hw/vfio/platform: " Zhao Liu
                   ` (6 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Alex Williamson, Cédric Le Goater

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

In hw/vfio/pci.c, there are 2 functions passing @errp to error_prepend()
without ERRP_GUARD():
- vfio_add_std_cap()
- vfio_realize()

The @errp of vfio_add_std_cap() is also from vfio_realize(). And
vfio_realize(), as a PCIDeviceClass.realize method, its @errp is from
DeviceClass.realize so that there is no guarantee that the @errp won't
point to @error_fatal.

To avoid the issue like [1] said, add missing ERRP_GUARD() at their
beginning.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: "Cédric Le Goater" <clg@redhat.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
---
 hw/vfio/pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index a1522a011aa5..64780d1b7933 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2136,6 +2136,7 @@ static void vfio_check_af_flr(VFIOPCIDevice *vdev, uint8_t pos)
 
 static int vfio_add_std_cap(VFIOPCIDevice *vdev, uint8_t pos, Error **errp)
 {
+    ERRP_GUARD();
     PCIDevice *pdev = &vdev->pdev;
     uint8_t cap_id, next, size;
     int ret;
@@ -2942,6 +2943,7 @@ static void vfio_unregister_req_notifier(VFIOPCIDevice *vdev)
 
 static void vfio_realize(PCIDevice *pdev, Error **errp)
 {
+    ERRP_GUARD();
     VFIOPCIDevice *vdev = VFIO_PCI(pdev);
     VFIODevice *vbasedev = &vdev->vbasedev;
     char *tmp, *subsys;
-- 
2.34.1



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

* [PATCH v2 24/29] hw/vfio/platform: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (22 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 23/29] hw/vfio/pci: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 25/29] hw/virtio/vhost-vsock: " Zhao Liu
                   ` (5 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Alex Williamson, Cédric Le Goater

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The vfio_platform_realize() passes @errp to error_prepend(), and as a
DeviceClass.realize method, there are too many possible callers to check
the impact of this defect; it may or may not be harmless. Thus it is
necessary to protect @errp with ERRP_GUARD().

To avoid the issue like [1] said, add missing ERRP_GUARD() at the
beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: "Cédric Le Goater" <clg@redhat.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
---
v2: Use Markus' sentence to polish commit message. (Markus)
---
 hw/vfio/platform.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c
index a8d9b7da633e..dcd2365fb353 100644
--- a/hw/vfio/platform.c
+++ b/hw/vfio/platform.c
@@ -576,6 +576,7 @@ static int vfio_base_device_init(VFIODevice *vbasedev, Error **errp)
  */
 static void vfio_platform_realize(DeviceState *dev, Error **errp)
 {
+    ERRP_GUARD();
     VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
     SysBusDevice *sbdev = SYS_BUS_DEVICE(dev);
     VFIODevice *vbasedev = &vdev->vbasedev;
-- 
2.34.1



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

* [PATCH v2 25/29] hw/virtio/vhost-vsock: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (23 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 24/29] hw/vfio/platform: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-12  8:53   ` Thomas Huth
  2024-03-11  3:38 ` [PATCH v2 26/29] hw/virtio/vhost: " Zhao Liu
                   ` (4 subsequent siblings)
  29 siblings, 1 reply; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Michael S. Tsirkin

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The vhost_vsock_device_realize() passes @errp to error_prepend(), and as
a VirtioDeviceClass.realize method, its @errp is from
DeviceClass.realize so that there is no guarantee that the @errp won't
point to @error_fatal.

To avoid the issue like [1] said, add missing ERRP_GUARD() at the
beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 hw/virtio/vhost-vsock.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index d5ca0b5a1055..3d4a5a97f484 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -121,6 +121,7 @@ static const VMStateDescription vmstate_virtio_vhost_vsock = {
 
 static void vhost_vsock_device_realize(DeviceState *dev, Error **errp)
 {
+    ERRP_GUARD();
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(dev);
     VirtIODevice *vdev = VIRTIO_DEVICE(dev);
     VHostVSock *vsock = VHOST_VSOCK(dev);
-- 
2.34.1



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

* [PATCH v2 26/29] hw/virtio/vhost: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (24 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 25/29] hw/virtio/vhost-vsock: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-12  9:09   ` Thomas Huth
  2024-03-11  3:38 ` [PATCH v2 27/29] migration/option: " Zhao Liu
                   ` (3 subsequent siblings)
  29 siblings, 1 reply; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Michael S. Tsirkin

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

In hw/virtio/vhost.c, there are 2 functions passing @errp to
error_prepend() without ERRP_GUARD():
- vhost_save_backend_state()
- vhost_load_backend_state()

Their @errp both points to callers' @local_err. However, as the APIs
defined in include/hw/virtio/vhost.h, it is necessary to protect their
@errp with ERRP_GUARD().

To follow the requirement of @errp, add missing ERRP_GUARD() at their
beginning.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 hw/virtio/vhost.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 2c9ac794680e..2e4e040db87a 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -2199,6 +2199,7 @@ int vhost_check_device_state(struct vhost_dev *dev, Error **errp)
 
 int vhost_save_backend_state(struct vhost_dev *dev, QEMUFile *f, Error **errp)
 {
+    ERRP_GUARD();
     /* Maximum chunk size in which to transfer the state */
     const size_t chunk_size = 1 * 1024 * 1024;
     g_autofree void *transfer_buf = NULL;
@@ -2291,6 +2292,7 @@ fail:
 
 int vhost_load_backend_state(struct vhost_dev *dev, QEMUFile *f, Error **errp)
 {
+    ERRP_GUARD();
     size_t transfer_buf_size = 0;
     g_autofree void *transfer_buf = NULL;
     g_autoptr(GError) g_err = NULL;
-- 
2.34.1



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

* [PATCH v2 27/29] migration/option: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (25 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 26/29] hw/virtio/vhost: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 28/29] net/vhost-vdpa: " Zhao Liu
                   ` (2 subsequent siblings)
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Peter Xu, Fabiano Rosas

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The migrate_params_check() passes @errp to error_prepend() without
ERRP_GUARD(), and it could be called from migration_object_init(),
where the passed @errp points to @error_fatal.

Therefore, the error message echoed in error_prepend() will be lost
because of the above issue.

To fix this, add missing ERRP_GUARD() at the beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Peter Xu <peterx@redhat.com>
Cc: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Acked-by: Peter Xu <peterx@redhat.com>
---
 migration/options.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/migration/options.c b/migration/options.c
index 40eb9309401c..caff0a271dff 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -1085,6 +1085,8 @@ void migrate_params_init(MigrationParameters *params)
  */
 bool migrate_params_check(MigrationParameters *params, Error **errp)
 {
+    ERRP_GUARD();
+
     if (params->has_compress_level &&
         (params->compress_level > 9)) {
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level",
-- 
2.34.1



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

* [PATCH v2 28/29] net/vhost-vdpa: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (26 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 27/29] migration/option: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  3:38 ` [PATCH v2 29/29] target/s390x/cpu_models: " Zhao Liu
  2024-03-12  8:17 ` [PATCH v2 00/29] Cleanup up to fix " Philippe Mathieu-Daudé
  29 siblings, 0 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Jason Wang

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

The net_init_vhost_vdpa() passes @errp to error_prepend(), and as a
member of net_client_init_fun[], it's called in net_client_init1() and
gets @errp from this caller.

But because netdev_init_modern() passes &error_fatal to
net_client_init1(), then @errp parameter of net_init_vhost_vdpa() would
point to @error_fatal. This causes the error message in error_prepend()
to be lost because of the above issue.

To fix this, add missing ERRP_GUARD() at the beginning of this function.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 net/vhost-vdpa.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index e6bdb4562dde..d81baecbc1a3 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -1751,6 +1751,7 @@ static int vhost_vdpa_get_max_queue_pairs(int fd, uint64_t features,
 int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
                         NetClientState *peer, Error **errp)
 {
+    ERRP_GUARD();
     const NetdevVhostVDPAOptions *opts;
     uint64_t features;
     int vdpa_device_fd;
-- 
2.34.1



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

* [PATCH v2 29/29] target/s390x/cpu_models: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (27 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 28/29] net/vhost-vdpa: " Zhao Liu
@ 2024-03-11  3:38 ` Zhao Liu
  2024-03-11  7:41   ` Cédric Le Goater
  2024-03-11  7:42   ` Cédric Le Goater
  2024-03-12  8:17 ` [PATCH v2 00/29] Cleanup up to fix " Philippe Mathieu-Daudé
  29 siblings, 2 replies; 45+ messages in thread
From: Zhao Liu @ 2024-03-11  3:38 UTC (permalink / raw)
  To: Thomas Huth, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, David Hildenbrand, Richard Henderson,
	Ilya Leoshkevich, qemu-s390x

From: Zhao Liu <zhao1.liu@intel.com>

As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
can't see this additional information, because exit() happens in
error_setg earlier than information is added [1].

In target/s390x/cpu_models.c, there are 2 functions passing @errp to
error_prepend() without ERRP_GUARD():
- check_compatibility()
- s390_realize_cpu_model()

Though both their @errp parameters point to their callers' local @err
virables and don't cause the issue as [1] said, to follow the
requirement of @errp, also add missing ERRP_GUARD() at their beginning.

[1]: Issue description in the commit message of commit ae7c80a7bd73
     ("error: New macro ERRP_GUARD()").

Cc: David Hildenbrand <david@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: qemu-s390x@nongnu.org
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 target/s390x/cpu_models.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index a63d990e4e8e..1a1c09612271 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -503,6 +503,7 @@ static void error_prepend_missing_feat(const char *name, void *opaque)
 static void check_compatibility(const S390CPUModel *max_model,
                                 const S390CPUModel *model, Error **errp)
 {
+    ERRP_GUARD();
     S390FeatBitmap missing;
 
     if (model->def->gen > max_model->def->gen) {
@@ -566,6 +567,7 @@ S390CPUModel *get_max_cpu_model(Error **errp)
 
 void s390_realize_cpu_model(CPUState *cs, Error **errp)
 {
+    ERRP_GUARD();
     Error *err = NULL;
     S390CPUClass *xcc = S390_CPU_GET_CLASS(cs);
     S390CPU *cpu = S390_CPU(cs);
-- 
2.34.1



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

* Re: [PATCH v2 29/29] target/s390x/cpu_models: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:38 ` [PATCH v2 29/29] target/s390x/cpu_models: " Zhao Liu
@ 2024-03-11  7:41   ` Cédric Le Goater
  2024-03-11  7:42   ` Cédric Le Goater
  1 sibling, 0 replies; 45+ messages in thread
From: Cédric Le Goater @ 2024-03-11  7:41 UTC (permalink / raw)
  To: Zhao Liu, Thomas Huth, Markus Armbruster, Michael Roth,
	Michael Tokarev, Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, David Hildenbrand, Richard Henderson,
	Ilya Leoshkevich, qemu-s390x

On 3/11/24 04:38, Zhao Liu wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> As the comment in qapi/error, passing @errp to error_prepend() requires
> ERRP_GUARD():
> 
> * = Why, when and how to use ERRP_GUARD() =
> *
> * Without ERRP_GUARD(), use of the @errp parameter is restricted:
> ...
> * - It should not be passed to error_prepend(), error_vprepend() or
> *   error_append_hint(), because that doesn't work with &error_fatal.
> * ERRP_GUARD() lifts these restrictions.
> *
> * To use ERRP_GUARD(), add it right at the beginning of the function.
> * @errp can then be used without worrying about the argument being
> * NULL or &error_fatal.
> 
> ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
> can't see this additional information, because exit() happens in
> error_setg earlier than information is added [1].
> 
> In target/s390x/cpu_models.c, there are 2 functions passing @errp to
> error_prepend() without ERRP_GUARD():
> - check_compatibility()
> - s390_realize_cpu_model()
> 
> Though both their @errp parameters point to their callers' local @err
> virables and don't cause the issue as [1] said, to follow the
> requirement of @errp, also add missing ERRP_GUARD() at their beginning.
> 
> [1]: Issue description in the commit message of commit ae7c80a7bd73
>       ("error: New macro ERRP_GUARD()").
> 
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Ilya Leoshkevich <iii@linux.ibm.com>
> Cc: qemu-s390x@nongnu.org
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---


Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.





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

* Re: [PATCH v2 29/29] target/s390x/cpu_models: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:38 ` [PATCH v2 29/29] target/s390x/cpu_models: " Zhao Liu
  2024-03-11  7:41   ` Cédric Le Goater
@ 2024-03-11  7:42   ` Cédric Le Goater
  1 sibling, 0 replies; 45+ messages in thread
From: Cédric Le Goater @ 2024-03-11  7:42 UTC (permalink / raw)
  To: Zhao Liu, Thomas Huth, Markus Armbruster, Michael Roth,
	Michael Tokarev, Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, David Hildenbrand, Richard Henderson,
	Ilya Leoshkevich, qemu-s390x

On 3/11/24 04:38, Zhao Liu wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> As the comment in qapi/error, passing @errp to error_prepend() requires
> ERRP_GUARD():
> 
> * = Why, when and how to use ERRP_GUARD() =
> *
> * Without ERRP_GUARD(), use of the @errp parameter is restricted:
> ...
> * - It should not be passed to error_prepend(), error_vprepend() or
> *   error_append_hint(), because that doesn't work with &error_fatal.
> * ERRP_GUARD() lifts these restrictions.
> *
> * To use ERRP_GUARD(), add it right at the beginning of the function.
> * @errp can then be used without worrying about the argument being
> * NULL or &error_fatal.
> 
> ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
> can't see this additional information, because exit() happens in
> error_setg earlier than information is added [1].
> 
> In target/s390x/cpu_models.c, there are 2 functions passing @errp to
> error_prepend() without ERRP_GUARD():
> - check_compatibility()
> - s390_realize_cpu_model()
> 
> Though both their @errp parameters point to their callers' local @err
> virables and don't cause the issue as [1] said, to follow the
> requirement of @errp, also add missing ERRP_GUARD() at their beginning.
> 
> [1]: Issue description in the commit message of commit ae7c80a7bd73
>       ("error: New macro ERRP_GUARD()").
> 
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Ilya Leoshkevich <iii@linux.ibm.com>
> Cc: qemu-s390x@nongnu.org
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---


Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.




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

* Re: [PATCH v2 18/29] hw/vfio/ap: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:38 ` [PATCH v2 18/29] hw/vfio/ap: " Zhao Liu
@ 2024-03-11  7:42   ` Cédric Le Goater
  0 siblings, 0 replies; 45+ messages in thread
From: Cédric Le Goater @ 2024-03-11  7:42 UTC (permalink / raw)
  To: Zhao Liu, Thomas Huth, Markus Armbruster, Michael Roth,
	Michael Tokarev, Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Alex Williamson, Tony Krowiak,
	Halil Pasic, Jason Herne, qemu-s390x

On 3/11/24 04:38, Zhao Liu wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> As the comment in qapi/error, passing @errp to error_prepend() requires
> ERRP_GUARD():
> 
> * = Why, when and how to use ERRP_GUARD() =
> *
> * Without ERRP_GUARD(), use of the @errp parameter is restricted:
> ...
> * - It should not be passed to error_prepend(), error_vprepend() or
> *   error_append_hint(), because that doesn't work with &error_fatal.
> * ERRP_GUARD() lifts these restrictions.
> *
> * To use ERRP_GUARD(), add it right at the beginning of the function.
> * @errp can then be used without worrying about the argument being
> * NULL or &error_fatal.
> 
> ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
> can't see this additional information, because exit() happens in
> error_setg earlier than information is added [1].
> 
> The vfio_ap_realize() passes @errp to error_prepend(), and as a
> DeviceClass.realize method, there are too many possible callers to check
> the impact of this defect; it may or may not be harmless. Thus it is
> necessary to protect @errp with ERRP_GUARD().
> 
> To avoid the issue like [1] said, add missing ERRP_GUARD() at the
> beginning of this function.
> 
> [1]: Issue description in the commit message of commit ae7c80a7bd73
>       ("error: New macro ERRP_GUARD()").
> 
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Cc: "Cédric Le Goater" <clg@redhat.com>
> Cc: Tony Krowiak <akrowiak@linux.ibm.com>
> Cc: Halil Pasic <pasic@linux.ibm.com>
> Cc: Jason Herne <jjherne@linux.ibm.com>
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: qemu-s390x@nongnu.org
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>


Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.


> ---
> v2: Use Markus' sentence to polish commit message. (Markus)
> ---
>   hw/vfio/ap.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
> index e157aa1ff79c..7c4caa593863 100644
> --- a/hw/vfio/ap.c
> +++ b/hw/vfio/ap.c
> @@ -155,6 +155,7 @@ static void vfio_ap_unregister_irq_notifier(VFIOAPDevice *vapdev,
>   
>   static void vfio_ap_realize(DeviceState *dev, Error **errp)
>   {
> +    ERRP_GUARD();
>       int ret;
>       Error *err = NULL;
>       VFIOAPDevice *vapdev = VFIO_AP_DEVICE(dev);



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

* Re: [PATCH v2 02/29] backends/iommufd: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 ` [PATCH v2 02/29] backends/iommufd: Fix missing ERRP_GUARD() for error_prepend() Zhao Liu
@ 2024-03-11  9:32   ` Eric Auger
  0 siblings, 0 replies; 45+ messages in thread
From: Eric Auger @ 2024-03-11  9:32 UTC (permalink / raw)
  To: Zhao Liu, Thomas Huth, Markus Armbruster, Michael Roth,
	Michael Tokarev, Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Yi Liu, Zhenzhong Duan



On 3/11/24 04:37, Zhao Liu wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
>
> As the comment in qapi/error, passing @errp to error_prepend() requires
> ERRP_GUARD():
>
> * = Why, when and how to use ERRP_GUARD() =
> *
> * Without ERRP_GUARD(), use of the @errp parameter is restricted:
> ...
> * - It should not be passed to error_prepend(), error_vprepend() or
> *   error_append_hint(), because that doesn't work with &error_fatal.
> * ERRP_GUARD() lifts these restrictions.
> *
> * To use ERRP_GUARD(), add it right at the beginning of the function.
> * @errp can then be used without worrying about the argument being
> * NULL or &error_fatal.
>
> ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
> can't see this additional information, because exit() happens in
> error_setg earlier than information is added [1].
>
> The iommufd_backend_set_fd() passes @errp to error_prepend(), to avoid
> the above issue, add missing ERRP_GUARD() at the beginning of this
> function.
>
> [1]: Issue description in the commit message of commit ae7c80a7bd73
>      ("error: New macro ERRP_GUARD()").
>
> Cc: Yi Liu <yi.l.liu@intel.com>
> Cc: Eric Auger <eric.auger@redhat.com>
> Cc: Zhenzhong Duan <zhenzhong.duan@intel.com>
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>

Reviewed-by: Eric Auger <eric.auger@redhat.com>

Eric
> ---
>  backends/iommufd.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/backends/iommufd.c b/backends/iommufd.c
> index 1ef683c7b080..62a79fa6b049 100644
> --- a/backends/iommufd.c
> +++ b/backends/iommufd.c
> @@ -43,6 +43,7 @@ static void iommufd_backend_finalize(Object *obj)
>  
>  static void iommufd_backend_set_fd(Object *obj, const char *str, Error **errp)
>  {
> +    ERRP_GUARD();
>      IOMMUFDBackend *be = IOMMUFD_BACKEND(obj);
>      int fd = -1;
>  



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

* Re: [PATCH v2 10/29] block/snapshot: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:38 ` [PATCH v2 10/29] block/snapshot: " Zhao Liu
@ 2024-03-12  8:11   ` Thomas Huth
  0 siblings, 0 replies; 45+ messages in thread
From: Thomas Huth @ 2024-03-12  8:11 UTC (permalink / raw)
  To: Zhao Liu, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Kevin Wolf, Hanna Reitz, qemu-block

On 11/03/2024 04.38, Zhao Liu wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> As the comment in qapi/error, passing @errp to error_prepend() requires
> ERRP_GUARD():
> 
> * = Why, when and how to use ERRP_GUARD() =
> *
> * Without ERRP_GUARD(), use of the @errp parameter is restricted:
> ...
> * - It should not be passed to error_prepend(), error_vprepend() or
> *   error_append_hint(), because that doesn't work with &error_fatal.
> * ERRP_GUARD() lifts these restrictions.
> *
> * To use ERRP_GUARD(), add it right at the beginning of the function.
> * @errp can then be used without worrying about the argument being
> * NULL or &error_fatal.
> 
> ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
> can't see this additional information, because exit() happens in
> error_setg earlier than information is added [1].
> 
> In block/snapshot.c, there are 2 functions passing @errp to
> error_prepend() without ERRP_GUARD():
>   - bdrv_all_delete_snapshot()
>   - bdrv_all_goto_snapshot()
> 
> As the APIs exposed in include/block/snapshot.h, they could be called
> by other modules.
> 
> To avoid potential issues as [1] said, add missing ERRP_GUARD() at the
> beginning of these 2 functions.
> 
> [1]: Issue description in the commit message of commit ae7c80a7bd73
>       ("error: New macro ERRP_GUARD()").
> 
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Hanna Reitz <hreitz@redhat.com>
> Cc: qemu-block@nongnu.org
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>   block/snapshot.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/block/snapshot.c b/block/snapshot.c
> index 8694fc0a3eba..8242b4abac41 100644
> --- a/block/snapshot.c
> +++ b/block/snapshot.c
> @@ -566,6 +566,7 @@ int bdrv_all_delete_snapshot(const char *name,
>                                bool has_devices, strList *devices,
>                                Error **errp)
>   {
> +    ERRP_GUARD();
>       g_autoptr(GList) bdrvs = NULL;
>       GList *iterbdrvs;
>   
> @@ -605,6 +606,7 @@ int bdrv_all_goto_snapshot(const char *name,
>                              bool has_devices, strList *devices,
>                              Error **errp)
>   {
> +    ERRP_GUARD();
>       g_autoptr(GList) bdrvs = NULL;
>       GList *iterbdrvs;
>       int ret;

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH v2 11/29] block/vdi: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:38 ` [PATCH v2 11/29] block/vdi: " Zhao Liu
@ 2024-03-12  8:14   ` Thomas Huth
  0 siblings, 0 replies; 45+ messages in thread
From: Thomas Huth @ 2024-03-12  8:14 UTC (permalink / raw)
  To: Zhao Liu, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Stefan Weil, Kevin Wolf, Hanna Reitz,
	qemu-block

On 11/03/2024 04.38, Zhao Liu wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> As the comment in qapi/error, passing @errp to error_prepend() requires
> ERRP_GUARD():
> 
> * = Why, when and how to use ERRP_GUARD() =
> *
> * Without ERRP_GUARD(), use of the @errp parameter is restricted:
> ...
> * - It should not be passed to error_prepend(), error_vprepend() or
> *   error_append_hint(), because that doesn't work with &error_fatal.
> * ERRP_GUARD() lifts these restrictions.
> *
> * To use ERRP_GUARD(), add it right at the beginning of the function.
> * @errp can then be used without worrying about the argument being
> * NULL or &error_fatal.
> 
> ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
> can't see this additional information, because exit() happens in
> error_setg earlier than information is added [1].
> 
> The vdi_co_do_create() passes @errp to error_prepend() without
> ERRP_GUARD(), and its @errp parameter is so widely sourced that it is
> necessary to protect it with ERRP_GUARD().
> 
> To avoid the potential issues as [1] said, add missing ERRP_GUARD() at
> the beginning of this function.
> 
> [1]: Issue description in the commit message of commit ae7c80a7bd73
>       ("error: New macro ERRP_GUARD()").
> 
> Cc: Stefan Weil <sw@weilnetz.de>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Hanna Reitz <hreitz@redhat.com>
> Cc: qemu-block@nongnu.org
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>   block/vdi.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/block/vdi.c b/block/vdi.c
> index 3b57becb9fe0..6363da08cee9 100644
> --- a/block/vdi.c
> +++ b/block/vdi.c
> @@ -738,6 +738,7 @@ static int coroutine_fn GRAPH_UNLOCKED
>   vdi_co_do_create(BlockdevCreateOptions *create_options, size_t block_size,
>                    Error **errp)
>   {
> +    ERRP_GUARD();
>       BlockdevCreateOptionsVdi *vdi_opts;
>       int ret = 0;
>       uint64_t bytes = 0;

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
                   ` (28 preceding siblings ...)
  2024-03-11  3:38 ` [PATCH v2 29/29] target/s390x/cpu_models: " Zhao Liu
@ 2024-03-12  8:17 ` Philippe Mathieu-Daudé
  2024-03-12  8:43   ` Zhao Liu
  29 siblings, 1 reply; 45+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-03-12  8:17 UTC (permalink / raw)
  To: Zhao Liu, Thomas Huth, Markus Armbruster, Michael Roth,
	Michael Tokarev, qemu-devel
  Cc: qemu-trivial, Zhao Liu

On 11/3/24 04:37, Zhao Liu wrote:

> ---
> Zhao Liu (29):

>    hw/core/loader-fit: Fix missing ERRP_GUARD() for error_prepend()
>    hw/core/qdev-properties-system: Fix missing ERRP_GUARD() for
>      error_prepend()
>    hw/misc/ivshmem: Fix missing ERRP_GUARD() for error_prepend()

I'm queuing these 3 patches, thanks!


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

* Re: [PATCH v2 12/29] block/vmdk: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:38 ` [PATCH v2 12/29] block/vmdk: " Zhao Liu
@ 2024-03-12  8:23   ` Thomas Huth
  0 siblings, 0 replies; 45+ messages in thread
From: Thomas Huth @ 2024-03-12  8:23 UTC (permalink / raw)
  To: Zhao Liu, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Fam Zheng, Kevin Wolf, Hanna Reitz,
	qemu-block

On 11/03/2024 04.38, Zhao Liu wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> As the comment in qapi/error, passing @errp to error_prepend() requires
> ERRP_GUARD():
> 
> * = Why, when and how to use ERRP_GUARD() =
> *
> * Without ERRP_GUARD(), use of the @errp parameter is restricted:
> ...
> * - It should not be passed to error_prepend(), error_vprepend() or
> *   error_append_hint(), because that doesn't work with &error_fatal.
> * ERRP_GUARD() lifts these restrictions.
> *
> * To use ERRP_GUARD(), add it right at the beginning of the function.
> * @errp can then be used without worrying about the argument being
> * NULL or &error_fatal.
> 
> ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
> can't see this additional information, because exit() happens in
> error_setg earlier than information is added [1].
> 
> The vmdk_parse_extents() passes @errp to error_prepend(), and its @errp
> is from vmdk_open().
> 
> Though, vmdk_open(), as a BlockDriver.bdrv_open(), gets the @errp
> parameter which is pointer of its caller's local_err, to follow the
> requirement of @errp, add missing ERRP_GUARD() at the beginning of this
> function.
> 
> [1]: Issue description in the commit message of commit ae7c80a7bd73
>       ("error: New macro ERRP_GUARD()").
> 
> Cc: Fam Zheng <fam@euphon.net>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Hanna Reitz <hreitz@redhat.com>
> Cc: qemu-block@nongnu.org
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>   block/vmdk.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/block/vmdk.c b/block/vmdk.c
> index bf78e1238351..3b82979fdf42 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -1147,6 +1147,7 @@ static int GRAPH_RDLOCK
>   vmdk_parse_extents(const char *desc, BlockDriverState *bs, QDict *options,
>                      Error **errp)
>   {
> +    ERRP_GUARD();
>       int ret;
>       int matches;
>       char access[11];

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend()
  2024-03-12  8:17 ` [PATCH v2 00/29] Cleanup up to fix " Philippe Mathieu-Daudé
@ 2024-03-12  8:43   ` Zhao Liu
  2024-03-12  8:50     ` Thomas Huth
  0 siblings, 1 reply; 45+ messages in thread
From: Zhao Liu @ 2024-03-12  8:43 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Thomas Huth, Michael Tokarev,
	Markus Armbruster
  Cc: Michael Roth, qemu-devel, qemu-trivial, Zhao Liu

Hi Thomas/Markus/Michael,

For the remaing patches, could you please help me merge them next?

Many thanks!
Zhao

On Tue, Mar 12, 2024 at 09:17:30AM +0100, Philippe Mathieu-Daudé wrote:
> Date: Tue, 12 Mar 2024 09:17:30 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: Re: [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for
>  error_prepend()
> 
> On 11/3/24 04:37, Zhao Liu wrote:
> 
> > ---
> > Zhao Liu (29):
> 
> >    hw/core/loader-fit: Fix missing ERRP_GUARD() for error_prepend()
> >    hw/core/qdev-properties-system: Fix missing ERRP_GUARD() for
> >      error_prepend()
> >    hw/misc/ivshmem: Fix missing ERRP_GUARD() for error_prepend()
> 
> I'm queuing these 3 patches, thanks!





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

* Re: [PATCH v2 17/29] hw/scsi/vhost-scsi: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:38 ` [PATCH v2 17/29] hw/scsi/vhost-scsi: " Zhao Liu
@ 2024-03-12  8:48   ` Thomas Huth
  0 siblings, 0 replies; 45+ messages in thread
From: Thomas Huth @ 2024-03-12  8:48 UTC (permalink / raw)
  To: Zhao Liu, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Paolo Bonzini, Fam Zheng,
	Michael S. Tsirkin

On 11/03/2024 04.38, Zhao Liu wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> As the comment in qapi/error, passing @errp to error_prepend() requires
> ERRP_GUARD():
> 
> * = Why, when and how to use ERRP_GUARD() =
> *
> * Without ERRP_GUARD(), use of the @errp parameter is restricted:
> ...
> * - It should not be passed to error_prepend(), error_vprepend() or
> *   error_append_hint(), because that doesn't work with &error_fatal.
> * ERRP_GUARD() lifts these restrictions.
> *
> * To use ERRP_GUARD(), add it right at the beginning of the function.
> * @errp can then be used without worrying about the argument being
> * NULL or &error_fatal.
> 
> ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
> can't see this additional information, because exit() happens in
> error_setg earlier than information is added [1].
> 
> The vhost_scsi_realize() passes @errp to error_prepend(), and as a
> VirtioDeviceClass.realize method, its @errp is from DeviceClass.realize
> so that there is no guarantee that the @errp won't point to
> @error_fatal.
> 
> To avoid the issue like [1] said, add missing ERRP_GUARD() at the
> beginning of this function.
> 
> [1]: Issue description in the commit message of commit ae7c80a7bd73
>       ("error: New macro ERRP_GUARD()").
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Fam Zheng <fam@euphon.net>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>   hw/scsi/vhost-scsi.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
> index 58a00336c2db..ae26bc19a457 100644
> --- a/hw/scsi/vhost-scsi.c
> +++ b/hw/scsi/vhost-scsi.c
> @@ -220,6 +220,7 @@ static int vhost_scsi_set_workers(VHostSCSICommon *vsc, bool per_virtqueue)
>   
>   static void vhost_scsi_realize(DeviceState *dev, Error **errp)
>   {
> +    ERRP_GUARD();
>       VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev);
>       VHostSCSICommon *vsc = VHOST_SCSI_COMMON(dev);
>       Error *err = NULL;

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend()
  2024-03-12  8:43   ` Zhao Liu
@ 2024-03-12  8:50     ` Thomas Huth
  2024-03-12 10:26       ` Zhao Liu
  0 siblings, 1 reply; 45+ messages in thread
From: Thomas Huth @ 2024-03-12  8:50 UTC (permalink / raw)
  To: Zhao Liu, Philippe Mathieu-Daudé, Michael Tokarev,
	Markus Armbruster
  Cc: Michael Roth, qemu-devel, qemu-trivial, Zhao Liu

On 12/03/2024 09.43, Zhao Liu wrote:
> Hi Thomas/Markus/Michael,
> 
> For the remaing patches, could you please help me merge them next?
> 
> Many thanks!

Yes, I'm currently reviewing the ones that don't have a Reviewed-by yet. I 
can pick up the remaining patches if the other maintainers won't pick them 
up for the softfreeze today.

  Thomas


> On Tue, Mar 12, 2024 at 09:17:30AM +0100, Philippe Mathieu-Daudé wrote:
>> Date: Tue, 12 Mar 2024 09:17:30 +0100
>> From: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Subject: Re: [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for
>>   error_prepend()
>>
>> On 11/3/24 04:37, Zhao Liu wrote:
>>
>>> ---
>>> Zhao Liu (29):
>>
>>>     hw/core/loader-fit: Fix missing ERRP_GUARD() for error_prepend()
>>>     hw/core/qdev-properties-system: Fix missing ERRP_GUARD() for
>>>       error_prepend()
>>>     hw/misc/ivshmem: Fix missing ERRP_GUARD() for error_prepend()
>>
>> I'm queuing these 3 patches, thanks!
> 
> 
> 



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

* Re: [PATCH v2 25/29] hw/virtio/vhost-vsock: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:38 ` [PATCH v2 25/29] hw/virtio/vhost-vsock: " Zhao Liu
@ 2024-03-12  8:53   ` Thomas Huth
  0 siblings, 0 replies; 45+ messages in thread
From: Thomas Huth @ 2024-03-12  8:53 UTC (permalink / raw)
  To: Zhao Liu, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Michael S. Tsirkin

On 11/03/2024 04.38, Zhao Liu wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> As the comment in qapi/error, passing @errp to error_prepend() requires
> ERRP_GUARD():
> 
> * = Why, when and how to use ERRP_GUARD() =
> *
> * Without ERRP_GUARD(), use of the @errp parameter is restricted:
> ...
> * - It should not be passed to error_prepend(), error_vprepend() or
> *   error_append_hint(), because that doesn't work with &error_fatal.
> * ERRP_GUARD() lifts these restrictions.
> *
> * To use ERRP_GUARD(), add it right at the beginning of the function.
> * @errp can then be used without worrying about the argument being
> * NULL or &error_fatal.
> 
> ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
> can't see this additional information, because exit() happens in
> error_setg earlier than information is added [1].
> 
> The vhost_vsock_device_realize() passes @errp to error_prepend(), and as
> a VirtioDeviceClass.realize method, its @errp is from
> DeviceClass.realize so that there is no guarantee that the @errp won't
> point to @error_fatal.
> 
> To avoid the issue like [1] said, add missing ERRP_GUARD() at the
> beginning of this function.
> 
> [1]: Issue description in the commit message of commit ae7c80a7bd73
>       ("error: New macro ERRP_GUARD()").
> 
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>   hw/virtio/vhost-vsock.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
> index d5ca0b5a1055..3d4a5a97f484 100644
> --- a/hw/virtio/vhost-vsock.c
> +++ b/hw/virtio/vhost-vsock.c
> @@ -121,6 +121,7 @@ static const VMStateDescription vmstate_virtio_vhost_vsock = {
>   
>   static void vhost_vsock_device_realize(DeviceState *dev, Error **errp)
>   {
> +    ERRP_GUARD();
>       VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(dev);
>       VirtIODevice *vdev = VIRTIO_DEVICE(dev);
>       VHostVSock *vsock = VHOST_VSOCK(dev);

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH v2 26/29] hw/virtio/vhost: Fix missing ERRP_GUARD() for error_prepend()
  2024-03-11  3:38 ` [PATCH v2 26/29] hw/virtio/vhost: " Zhao Liu
@ 2024-03-12  9:09   ` Thomas Huth
  0 siblings, 0 replies; 45+ messages in thread
From: Thomas Huth @ 2024-03-12  9:09 UTC (permalink / raw)
  To: Zhao Liu, Markus Armbruster, Michael Roth, Michael Tokarev,
	Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Zhao Liu, Michael S. Tsirkin

On 11/03/2024 04.38, Zhao Liu wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> As the comment in qapi/error, passing @errp to error_prepend() requires
> ERRP_GUARD():
> 
> * = Why, when and how to use ERRP_GUARD() =
> *
> * Without ERRP_GUARD(), use of the @errp parameter is restricted:
> ...
> * - It should not be passed to error_prepend(), error_vprepend() or
> *   error_append_hint(), because that doesn't work with &error_fatal.
> * ERRP_GUARD() lifts these restrictions.
> *
> * To use ERRP_GUARD(), add it right at the beginning of the function.
> * @errp can then be used without worrying about the argument being
> * NULL or &error_fatal.
> 
> ERRP_GUARD() could avoid the case when @errp is &error_fatal, the user
> can't see this additional information, because exit() happens in
> error_setg earlier than information is added [1].
> 
> In hw/virtio/vhost.c, there are 2 functions passing @errp to
> error_prepend() without ERRP_GUARD():
> - vhost_save_backend_state()
> - vhost_load_backend_state()
> 
> Their @errp both points to callers' @local_err. However, as the APIs
> defined in include/hw/virtio/vhost.h, it is necessary to protect their
> @errp with ERRP_GUARD().
> 
> To follow the requirement of @errp, add missing ERRP_GUARD() at their
> beginning.
> 
> [1]: Issue description in the commit message of commit ae7c80a7bd73
>       ("error: New macro ERRP_GUARD()").
> 
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>   hw/virtio/vhost.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index 2c9ac794680e..2e4e040db87a 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -2199,6 +2199,7 @@ int vhost_check_device_state(struct vhost_dev *dev, Error **errp)
>   
>   int vhost_save_backend_state(struct vhost_dev *dev, QEMUFile *f, Error **errp)
>   {
> +    ERRP_GUARD();
>       /* Maximum chunk size in which to transfer the state */
>       const size_t chunk_size = 1 * 1024 * 1024;
>       g_autofree void *transfer_buf = NULL;
> @@ -2291,6 +2292,7 @@ fail:
>   
>   int vhost_load_backend_state(struct vhost_dev *dev, QEMUFile *f, Error **errp)
>   {
> +    ERRP_GUARD();
>       size_t transfer_buf_size = 0;
>       g_autofree void *transfer_buf = NULL;
>       g_autoptr(GError) g_err = NULL;

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend()
  2024-03-12  8:50     ` Thomas Huth
@ 2024-03-12 10:26       ` Zhao Liu
  2024-03-12 10:42         ` Thomas Huth
  0 siblings, 1 reply; 45+ messages in thread
From: Zhao Liu @ 2024-03-12 10:26 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Philippe Mathieu-Daudé, Michael Tokarev, Markus Armbruster,
	Michael Roth, qemu-devel, qemu-trivial, Zhao Liu

On Tue, Mar 12, 2024 at 09:50:25AM +0100, Thomas Huth wrote:
> Date: Tue, 12 Mar 2024 09:50:25 +0100
> From: Thomas Huth <thuth@redhat.com>
> Subject: Re: [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for
>  error_prepend()
> 
> On 12/03/2024 09.43, Zhao Liu wrote:
> > Hi Thomas/Markus/Michael,
> > 
> > For the remaing patches, could you please help me merge them next?
> > 
> > Many thanks!
> 
> Yes, I'm currently reviewing the ones that don't have a Reviewed-by yet. I
> can pick up the remaining patches if the other maintainers won't pick them
> up for the softfreeze today.
> 

Appreciate that you can help me get on the last train of releases.

If possible, could you please also help me pick up two other ERRP_GUARD()
related cleanups (total 8 patches, both got r/b)? ;-)

My cleanup is too fragmented, I'll try to centralize my work to make it easier
for maintainer to review and merge in the future!

[1]: https://lore.kernel.org/qemu-devel/20240223085653.1255438-1-zhao1.liu@linux.intel.com/
[2]: https://lore.kernel.org/qemu-devel/20240312060337.3240965-1-zhao1.liu@linux.intel.com/

Many thanks,
Zhao



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

* Re: [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend()
  2024-03-12 10:26       ` Zhao Liu
@ 2024-03-12 10:42         ` Thomas Huth
  0 siblings, 0 replies; 45+ messages in thread
From: Thomas Huth @ 2024-03-12 10:42 UTC (permalink / raw)
  To: Zhao Liu
  Cc: Philippe Mathieu-Daudé, Michael Tokarev, Markus Armbruster,
	Michael Roth, qemu-devel, qemu-trivial, Zhao Liu

On 12/03/2024 11.26, Zhao Liu wrote:
> On Tue, Mar 12, 2024 at 09:50:25AM +0100, Thomas Huth wrote:
>> Date: Tue, 12 Mar 2024 09:50:25 +0100
>> From: Thomas Huth <thuth@redhat.com>
>> Subject: Re: [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for
>>   error_prepend()
>>
>> On 12/03/2024 09.43, Zhao Liu wrote:
>>> Hi Thomas/Markus/Michael,
>>>
>>> For the remaing patches, could you please help me merge them next?
>>>
>>> Many thanks!
>>
>> Yes, I'm currently reviewing the ones that don't have a Reviewed-by yet. I
>> can pick up the remaining patches if the other maintainers won't pick them
>> up for the softfreeze today.
>>
> 
> Appreciate that you can help me get on the last train of releases.
> 
> If possible, could you please also help me pick up two other ERRP_GUARD()
> related cleanups (total 8 patches, both got r/b)? ;-)
> 
> My cleanup is too fragmented, I'll try to centralize my work to make it easier
> for maintainer to review and merge in the future!
> 
> [1]: https://lore.kernel.org/qemu-devel/20240223085653.1255438-1-zhao1.liu@linux.intel.com/
> [2]: https://lore.kernel.org/qemu-devel/20240312060337.3240965-1-zhao1.liu@linux.intel.com/

I'll try to include them!

  Thomas




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

end of thread, other threads:[~2024-03-12 10:43 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-11  3:37 [PATCH v2 00/29] Cleanup up to fix missing ERRP_GUARD() for error_prepend() Zhao Liu
2024-03-11  3:37 ` [PATCH v2 01/29] error: Add error_vprepend() in comment of ERRP_GUARD() rules Zhao Liu
2024-03-11  3:37 ` [PATCH v2 02/29] backends/iommufd: Fix missing ERRP_GUARD() for error_prepend() Zhao Liu
2024-03-11  9:32   ` Eric Auger
2024-03-11  3:37 ` [PATCH v2 03/29] block: " Zhao Liu
2024-03-11  3:37 ` [PATCH v2 04/29] block/copy-before-write: " Zhao Liu
2024-03-11  3:37 ` [PATCH v2 05/29] block/nbd: " Zhao Liu
2024-03-11  3:37 ` [PATCH v2 06/29] block/nvme: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 07/29] block/qcow2-bitmap: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 08/29] block/qcow2: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 09/29] block/qed: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 10/29] block/snapshot: " Zhao Liu
2024-03-12  8:11   ` Thomas Huth
2024-03-11  3:38 ` [PATCH v2 11/29] block/vdi: " Zhao Liu
2024-03-12  8:14   ` Thomas Huth
2024-03-11  3:38 ` [PATCH v2 12/29] block/vmdk: " Zhao Liu
2024-03-12  8:23   ` Thomas Huth
2024-03-11  3:38 ` [PATCH v2 13/29] block/virtio-blk: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 14/29] hw/core/loader-fit: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 15/29] hw/core/qdev-properties-system: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 16/29] hw/misc/ivshmem: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 17/29] hw/scsi/vhost-scsi: " Zhao Liu
2024-03-12  8:48   ` Thomas Huth
2024-03-11  3:38 ` [PATCH v2 18/29] hw/vfio/ap: " Zhao Liu
2024-03-11  7:42   ` Cédric Le Goater
2024-03-11  3:38 ` [PATCH v2 19/29] hw/vfio/container: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 20/29] hw/vfio/helpers: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 21/29] hw/vfio/iommufd: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 22/29] hw/vfio/pci-quirks: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 23/29] hw/vfio/pci: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 24/29] hw/vfio/platform: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 25/29] hw/virtio/vhost-vsock: " Zhao Liu
2024-03-12  8:53   ` Thomas Huth
2024-03-11  3:38 ` [PATCH v2 26/29] hw/virtio/vhost: " Zhao Liu
2024-03-12  9:09   ` Thomas Huth
2024-03-11  3:38 ` [PATCH v2 27/29] migration/option: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 28/29] net/vhost-vdpa: " Zhao Liu
2024-03-11  3:38 ` [PATCH v2 29/29] target/s390x/cpu_models: " Zhao Liu
2024-03-11  7:41   ` Cédric Le Goater
2024-03-11  7:42   ` Cédric Le Goater
2024-03-12  8:17 ` [PATCH v2 00/29] Cleanup up to fix " Philippe Mathieu-Daudé
2024-03-12  8:43   ` Zhao Liu
2024-03-12  8:50     ` Thomas Huth
2024-03-12 10:26       ` Zhao Liu
2024-03-12 10:42         ` Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).