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

Re: [libvirt] [PATCH v3 14/21] LXC from native: add lxc.cgroup.blkio.* mapping



On Wed, Feb 05, 2014 at 03:10:12PM +0100, Cédric Bosdonnat wrote:
> ---
>  src/lxc/lxc_native.c                               | 63 ++++++++++++++++++++++
>  tests/lxcconf2xmldata/lxcconf2xml-blkiotune.config |  7 +++
>  tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml    | 35 ++++++++++++
>  tests/lxcconf2xmltest.c                            |  1 +
>  4 files changed, 106 insertions(+)
>  create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-blkiotune.config
>  create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml

> +    if ((!(parts = lxcStringSplit(value->str)) && (!parts[0] || !parts[1]))) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("invalid blkio.device_weight value: '%s'"),
> +                       value->str);
> +        goto error;
> +    }

The conditional here is wrong and crashes if lxcStringSplit returns
NULL.


ACK and will add the following

@@ -709,7 +709,10 @@ lxcBlkioDeviceWalkCallback(const char *name, virConfValuePtr value, void *data)
     if (STRNEQ(name, "lxc.cgroup.blkio.device_weight") || !value->str)
         return 0;
 
-    if ((!(parts = lxcStringSplit(value->str)) && (!parts[0] || !parts[1]))) {
+    if (!(parts = lxcStringSplit(value->str)))
+        return -1;
+
+    if (!parts[0] || !parts[1]) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("invalid blkio.device_weight value: '%s'"),
                        value->str);


-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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