[lxc-devel] [lxcfs/master] cgroups: please Coverity
brauner on Github
lxc-bot at linuxcontainers.org
Fri Apr 17 13:34:29 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 390 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200417/81c02198/attachment.bin>
-------------- next part --------------
From 0cf1e5935b0190069b887e8de8a64577ea30a238 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at 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.brauner at 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);
/*
More information about the lxc-devel
mailing list