On Fri, 3 Oct 2025 at 16:40, Peter Xu <[email protected]> wrote:
>
> From: Steve Sistare <[email protected]>
>
> To preserve CPR state across exec, create a QEMUFile based on a memfd, and
> keep the memfd open across exec.  Save the value of the memfd in an
> environment variable so post-exec QEMU can find it.
>
> These new functions are called in a subsequent patch.
>

Hi; Coverity complains about this function:

> +void cpr_exec_persist_state(QEMUFile *f)
> +{
> +    QIOChannelFile *fioc = QIO_CHANNEL_FILE(qemu_file_get_ioc(f));
> +    int mfd = dup(fioc->fd);

CID 1641392: we open an fd here, but we don't return it
and we don't close it, so Coverity thinks we leak it.
Judging by the commit message, this is a false positive.

> +    char val[16];
> +
> +    /* Remember mfd in environment for post-exec load */
> +    qemu_clear_cloexec(mfd);
> +    snprintf(val, sizeof(val), "%d", mfd);
> +    g_setenv(CPR_EXEC_STATE_NAME, val, 1);

CID 1641391: g_setenv() can fail, but we ignore the return
value here.

> +}

thanks
-- PMM

Reply via email to