[lxc-devel] [lxc/master] cgroups: do not pass NULL pointer

brauner on Github lxc-bot at linuxcontainers.org
Wed Apr 15 09:58:15 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/20200415/c2c1e539/attachment.bin>
-------------- next part --------------
From 83b25c4d371676bbdf164f14227ab9260a8ad530 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 15 Apr 2020 11:56:54 +0200
Subject: [PATCH] cgroups: do not pass NULL pointer

Fixes: Coverity 1461752.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/cgroups/cgfsng.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
index a6ee6875e3..cabc39fb34 100644
--- a/src/lxc/cgroups/cgfsng.c
+++ b/src/lxc/cgroups/cgfsng.c
@@ -2736,6 +2736,9 @@ static int device_cgroup_rule_parse_devpath(struct device_item *device,
 			return ret_set_errno(-1, EINVAL);
 	}
 
+	if (!mode)
+		return ret_errno(EINVAL);
+
 	if (device_cgroup_parse_access(device, mode) < 0)
 		return -1;
 


More information about the lxc-devel mailing list