The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxcfs/pull/397

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Fixes: Coverity 355759.
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
From 0cf1e5935b0190069b887e8de8a64577ea30a238 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@ubuntu.com>
Date: Fri, 17 Apr 2020 15:33:01 +0200
Subject: [PATCH] cgroups: please Coverity

Fixes: Coverity 355759.
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
---
 src/cgroups/cgroup_utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cgroups/cgroup_utils.c b/src/cgroups/cgroup_utils.c
index fe97b5c..6255a71 100644
--- a/src/cgroups/cgroup_utils.c
+++ b/src/cgroups/cgroup_utils.c
@@ -770,6 +770,8 @@ int cgroup_walkup_to_root(int cgroup2_root_fd, int 
hierarchy_fd,
        val = readat_file(dir_fd, file);
        if (is_empty_string(val) || strcmp(val, "max") == 0) {
                no_limit = true;
+               if (same_file(cgroup2_root_fd, dir_fd))
+                       return 1;
        } else {
                *value = move_ptr(val);
                return 0;
@@ -781,8 +783,6 @@ int cgroup_walkup_to_root(int cgroup2_root_fd, int 
hierarchy_fd,
         */
        if (cgroup2_root_fd < 0)
                return -EINVAL;
-       else if (same_file(cgroup2_root_fd, dir_fd))
-               return no_limit ? 1 : -EINVAL;
 
        free_disarm(val);
        /*
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to