Blob Blame History Raw
From dd46b194155d91d44d8c10f5bca48a5b4d296f63 Mon Sep 17 00:00:00 2001
Message-Id: <dd46b194155d91d44d8c10f5bca48a5b4d296f63@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Wed, 21 Aug 2019 09:42:35 +0200
Subject: [PATCH] vircgroupv2: fix virCgroupV2GetCpuCfsQuota for "max" value

If the first value in cpu.max is "max" return from function.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1741837

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 23689cddd4542041cdfa3416705993d373033961)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <287fbea9b44a5f7263505dc5fbd72d1bf2692bc6.1566373284.git.phrdina@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/util/vircgroupv2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index e129686a52..e31a2d1121 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -1581,8 +1581,10 @@ virCgroupV2GetCpuCfsQuota(virCgroupPtr group,
         return -1;
     }
 
-    if (STREQLEN(str, "max", 3))
+    if (STREQLEN(str, "max", 3)) {
         *cfs_quota = ULLONG_MAX / 1000;
+        return 0;
+    }
 
     if (virStrToLong_ll(str, &str, 10, cfs_quota) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-- 
2.23.0