qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PULL 33/54] block: Introduce BdrvChildRol


From: Peter Maydell
Subject: Re: [Qemu-block] [Qemu-devel] [PULL 33/54] block: Introduce BdrvChildRole.update_filename
Date: Fri, 3 Nov 2017 18:34:10 +0000

On 6 October 2017 at 16:54, Kevin Wolf <address@hidden> wrote:
> There is no good reason for bdrv_drop_intermediate() to know the active
> layer above the subchain it is operating on - even more so, because
> the assumption that there is a single active layer above it is not
> generally true.
>
> In order to prepare removal of the active parameter, use a BdrvChildRole
> callback to update the backing file string in the overlay image instead
> of directly calling bdrv_change_backing_file().
>
> Signed-off-by: Kevin Wolf <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>

Hi. Coverity complains about this (CID1381628):

> +static int bdrv_backing_update_filename(BdrvChild *c, BlockDriverState *base,
> +                                        const char *filename, Error **errp)
> +{
> +    BlockDriverState *parent = c->opaque;
> +    int ret;
> +
> +    ret = bdrv_change_backing_file(parent, filename,
> +                                   base->drv ? base->drv->format_name : "");
> +    if (ret < 0) {
> +        error_setg_errno(errp, ret, "Could not update backing file link");

because error_setg_errno() expects a positive errno value, but
bdrv_change_backing_file() returns negative errnos.

The simple fix is to pass "-ret" here.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]