qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [Qemu-devel] [PULL 30/56] file-posix: Support .bdrv_co_


From: Peter Maydell
Subject: Re: [Qemu-block] [Qemu-devel] [PULL 30/56] file-posix: Support .bdrv_co_create
Date: Tue, 8 May 2018 16:26:13 +0100

On 9 March 2018 at 16:19, Kevin Wolf <address@hidden> wrote:
> This adds the .bdrv_co_create driver callback to file, which enables
> image creation over QMP.
> +static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts 
> *opts,
> +                                           Error **errp)
> +{
> +    BlockdevCreateOptions options;
> +    int64_t total_size = 0;
> +    bool nocow = false;
> +    PreallocMode prealloc;
> +    char *buf = NULL;
> +    Error *local_err = NULL;
> +
> +    /* Skip file: protocol prefix */
> +    strstart(filename, "file:", &filename);

This isn't new, but the code-motion causes Coverity to notice
(CID 1390569) that this strstart() return value isn't checked (which
we apparently do in 98 of the other 100 callsites). The "doesn't
begin with 'file:'" case can't happen given the BlockDriver struct
definition, though, so I've marked the warning as false-positive.
I mention it just in case you think it's worth adding an
"assert(filename);" here (and similarly in file-win32.c).

thanks
-- PMM



reply via email to

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