Re: [PATCH 0/5] Get rid of "no_memory" labels

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

 



On 12/20/19 7:43 AM, Fabiano Fidêncio wrote:
> As pointed out by Ján Tomko, "no_memory seems suspicious in the times of
> abort()".
> 
> As libvirt decided to take the path to not report OOM and simply abort
> when it happens, let's get rid of the no_memory labels and simplify the
> code around them.
> 

Series:
Reviewed-by: Cole Robinson <crobinso@xxxxxxxxxx>

> The two exceptions are:
> - phyp code, as libvirt may end up dropping this code entirely;
> - virfirewall.c code, as it seems we heavily really on firewall->err
>   being set to ENOMEM;
> 

I looked at it a bit. It can probably all be ripped out but it's a
little convoluted. virCommand seems to have some similar ENOMEM handling
as well.

I think a nice prep step that will simplify this style of cleanups, is
to drop the return value from the VIR_*LLOC* macros. After the glib
conversion, they always return 0, or abort. But everywhere in the code
is still checking for 'if (VIR_ALLOC(foo) < 0)' and similar.

Long term we should replace that with g_new0 but it's not a drop in
replacement. An easy intermediate step we can do is entirely drop the '<
0' checking. This will removal a lot of 'if' conditionals that would
need to be tweaked if we work on dropping cleanup: labels now. It could
be mass done per directory and outside of a few cases I think they would
all be trivial.

I think after a step like that, there would be many util/ functions that
never return error, which is another thing to unwind up the chain.

- Cole

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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