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

Peter Krempa pkrempa at redhat.com
Thu May 31 08:56:08 UTC 2018


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180531/7ee5dde7/attachment-0001.sig>


More information about the libvir-list mailing list