[libvirt] [PATCH v1 28/37] Adapt to VIR_ALLOC and virAsprintf in src/util/*

Martin Kletzander mkletzan at redhat.com
Mon Jul 8 09:15:42 UTC 2013


On 07/04/2013 02:06 PM, Michal Privoznik wrote:
[...]
> diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
> index 13fd162..f7f05fd 100644
> --- a/src/util/vircgroup.c
> +++ b/src/util/vircgroup.c
> @@ -1212,8 +1211,6 @@ static int virCgroupSetPartitionSuffix(const char *path, char **res)
>  
>          ret = virCgroupPartitionEscape(&(tokens[i]));
>          if (ret < 0) {
> -            if (ret == -ENOMEM)
> -                virReportOOMError();

virCgroupPartitionEscape() does not report OOMError, either keep it here
or change the VIR_INSERT_ELEMENT and others inside that function to
report the error.

[...]
> diff --git a/src/util/virlog.c b/src/util/virlog.c
> index 064f8e8..1dcbd61 100644
> --- a/src/util/virlog.c
> +++ b/src/util/virlog.c
> @@ -563,7 +563,7 @@ virLogDefineFilter(const char *match,
>          goto cleanup;
>      }
>      i = virLogNbFilters;
> -    if (VIR_REALLOC_N(virLogFilters, virLogNbFilters + 1)) {
> +    if (VIR_REALLOC_N_QUIET(virLogFilters, virLogNbFilters + 1)) {
>          i = -1;
>          VIR_FREE(mdup);
>          goto cleanup;

There are couple more places in this file where the OOMError wasn't
reported and is going to be reported after this series takes place.  The
problem is that the error would be reported after virLogLock() and that
would lead to either a deadlock or infinite recursion (depending on
where it would happen).  Such occurrences need to be fixed as well.

[...]
> diff --git a/src/util/virpci.c b/src/util/virpci.c
> index 9ed257e..e42f6fa 100644
> --- a/src/util/virpci.c
> +++ b/src/util/virpci.c
> @@ -2395,7 +2357,6 @@ virPCIGetPhysicalFunction(const char *vf_sysfs_path,
>                "with sysfs path '%s'", vf_sysfs_path);
>  
>      if (virBuildPath(&device_link, vf_sysfs_path, "physfn") == -1) {
> -        virReportOOMError();

Same problem as with the virCgroupPartitionEscape().

ACK with mentioned things fixed.

Martin




More information about the libvir-list mailing list