On Thu, Feb 29, 2024 at 12:37:10AM +0800, Zhao Liu wrote:
> From: Zhao Liu <[email protected]>
>
> As the comment in qapi/error, passing @errp to error_prepend() requires
> ERRP_GUARD():
>
>
> In block.c, there're 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(), as an implementation of
> BolckDriver.bdrv_co_create_opts(), its @errp parameter is so widely
BlockDriver
> sourced that it is necessary to protect it 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 <[email protected]>
> Cc: Hanna Reitz <[email protected]>
> Signed-off-by: Zhao Liu <[email protected]>
> ---
> block.c | 4 ++++
> 1 file changed, 4 insertions(+)
Reviewed-by: Eric Blake <[email protected]>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org