qemu-devel
[Top][All Lists]
Advanced

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

Re: [PULL 18/31] block/core: add generic infrastructure for x-blockdev-a


From: Max Reitz
Subject: Re: [PULL 18/31] block/core: add generic infrastructure for x-blockdev-amend qmp command
Date: Fri, 10 Jul 2020 11:54:11 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

On 09.07.20 17:09, Peter Maydell wrote:
> On Mon, 6 Jul 2020 at 11:05, Max Reitz <mreitz@redhat.com> wrote:
>>
>> From: Maxim Levitsky <mlevitsk@redhat.com>
>>
>> blockdev-amend will be used similiar to blockdev-create
>> to allow on the fly changes of the structure of the format based block 
>> devices.
>>
>> Current plan is to first support encryption keyslot management for luks
>> based formats (raw and embedded in qcow2)
>>
>> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
>> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>> Message-Id: <20200608094030.670121-12-mlevitsk@redhat.com>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
> 
> Hi; Coverity reports a possible issue with this function
> (CID 1430268):

Thanks for the heads-up, I’ve sent a patch (“block/amend: Check whether
the node exists”).

>> +void qmp_x_blockdev_amend(const char *job_id,
>> +                          const char *node_name,
>> +                          BlockdevAmendOptions *options,
>> +                          bool has_force,
>> +                          bool force,
>> +                          Error **errp)
>> +{
>> +    BlockdevAmendJob *s;
>> +    const char *fmt = BlockdevDriver_str(options->driver);
>> +    BlockDriver *drv = bdrv_find_format(fmt);
>> +    BlockDriverState *bs = bdrv_find_node(node_name);
> 
> bdrv_find_node() can return NULL (we check for this
> in almost all callsites)...
> 
>> +    if (bs->drv != drv) {
> 
> ...but here we dereference it unconditionally.
> 
>> +        error_setg(errp,
>> +                   "x-blockdev-amend doesn't support changing the block 
>> driver");
>> +        return;
>> +    }
> 
> thanks
> -- PMM
> 


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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