On 6 October 2017 at 16:54, Kevin Wolf <kw...@redhat.com> 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 <kw...@redhat.com>
> Reviewed-by: Eric Blake <ebl...@redhat.com>

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