qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/2] blkdebug: Simplify and improve filename


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 1/2] blkdebug: Simplify and improve filename generation
Date: Mon, 10 Nov 2014 12:15:27 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 11/10/2014 09:59 AM, Max Reitz wrote:
> Instead of actually recreating the options from scratch, just reuse the
> options given for creating the BDS, which are the configuration file
> name and additional options. In case there are no additional options we
> can thus create a plain filename.
> 
> This obviously results in a different output for qemu-iotest 099 which
> exactly tests this filename generation. Fix it up as well.
> 
> Signed-off-by: Max Reitz <address@hidden>
> ---
>  block/blkdebug.c           | 98 
> +++++++++++++---------------------------------
>  tests/qemu-iotests/099.out |  4 +-
>  2 files changed, 29 insertions(+), 73 deletions(-)
> 

>  
> +    if (!force_json && bs->file->exact_filename[0]) {
> +        snprintf(bs->exact_filename, sizeof(bs->exact_filename),
> +                 "blkdebug:%s:%s", qdict_get_try_str(bs->options, "config"),

If there is no "config" entry, this can pass NULL as a %s counterpart to
snprintf, which is undefined behavior (works on glibc, but might crash
elsewhere).

Everything else looked okay, but I'm afraid I may have given you reason
to post a v3 and make a kitten cry :(

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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