qemu-devel
[Top][All Lists]
Advanced

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

Re: [PULL 06/22] hw/nvram: Introduce Xilinx battery-backed ram


From: Peter Maydell
Subject: Re: [PULL 06/22] hw/nvram: Introduce Xilinx battery-backed ram
Date: Fri, 1 Apr 2022 15:23:09 +0100

On Thu, 30 Sept 2021 at 16:12, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> From: Tong Ho <tong.ho@xilinx.com>
>
> This device is present in Versal and ZynqMP product
> families to store a 256-bit encryption key.

Hi; Coverity points out a bug in this change (CID 1487233):

> +static void bbram_bdrv_error(XlnxBBRam *s, int rc, gchar *detail)
> +{
> +    Error *errp;
> +
> +    error_setg_errno(&errp, -rc, "%s: BBRAM backstore %s failed.",
> +                     blk_name(s->blk), detail);

The Error** argument to error_setg() and error_setg_errno()
needs to (assuming it's not one of the special cases
&error_abort or &error_fatal) point to an Error* that has
been initialized to NULL. (The comment on error_setg() in
include/qapi/error.h explains this.)

So this function needs to start "Error *errp = NULL;"
to avoid a probable assert() inside error_setg().

> +    error_report("%s", error_get_pretty(errp));
> +    error_free(errp);
> +
> +    g_free(detail);
> +}

thanks
-- PMM



reply via email to

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