[libvirt] [PATCH] audit: Enforce enum switch type cast in virDomainAuditHostdev

Michal Privoznik mprivozn at redhat.com
Thu May 31 09:44:06 UTC 2018


On 05/31/2018 10:56 AM, Peter Krempa wrote:
> On Thu, May 31, 2018 at 10:16:41 +0200, Michal Privoznik wrote:
>> On 05/31/2018 10:05 AM, Erik Skultety wrote:
> 
> [...]
> 
>>> @@ -419,6 +420,13 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev,
>>>                  goto cleanup;
>>>              }
>>>              break;
>>> +        case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
>>> +            if (VIR_STRDUP_QUIET(address, mdevsrc->uuidstr) < 0) {
>>> +                VIR_WARN("OOM while enconding audit message");
>>> +                goto cleanup;
>>> +            }
>>> +            break;
>>
>> This makes sense.
>>
>>> +        case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:>          default:
>>
>> But this does not. Well, in combination with [1] it doesn't. Firstly,
>> why do we even have "default" labels? Secondly, what's the point of
>> typecasting when we have "default" label? Same goes for the outer
>> switch(). I think we should remove "default" labels.
> 
> We are doing the opposite now. Some reading you probably missed:
> 
> https://www.redhat.com/archives/libvir-list/2018-February/msg00728.html
> 

Ah, good point. ACK and safe for freeze then.

Michal




More information about the libvir-list mailing list