Re: [PATCH 4/4] bhyve: parse "passthru" commandline argument

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

 



On Tue, Feb 25, 2025 at 21:27:43 +0100, Roman Bogorodskiy wrote:
>   Peter Krempa wrote:

[...]

> > > Need to check if hostdev is NULL.
> > 
> > That can't happen:
> > 
> > virDomainHostdevDef *
> > virDomainHostdevDefNew(void)
> > {
> >     virDomainHostdevDef *def;
> > 
> >     def = g_new0(virDomainHostdevDef, 1);
> > 
> >     def->info = g_new0(virDomainDeviceInfo, 1);
> > 
> >     return def;
> > }
> > 
> > g_new0() abort()'s on OOM, thus this is guaranteed to return a valid
> > pointer.
> > 
> 
> Hm, interesting, that's been using g_new0() for about 5 years now.
> 
> Looks like there are a few places that need to be clean up then, e.g.
> right in the same file (conf/domain_conf.c) in virDomainHostdevDefParseXML(), and some drivers as well.

Yeah; the thing is that many places were not cleaned up since the
code was refactored to use g_new0 instead of VIR_ALLOC and this seems to
be one of them. If you want to clean up stuff go ahead but for now we
accept the fact that there are leftovers.

It's just that new code doesn't necessarily need to add more checks.



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux