cgroups: improve parameter vetting

parent 7d013ccc
......@@ -2622,8 +2622,9 @@ __cgfsng_ops static int cgfsng_set(struct cgroup_ops *ops,
struct hierarchy *h;
int ret = -1;
if (!ops || !key || !value || !name || !lxcpath)
return ret_errno(ENOENT);
if (!ops || is_empty_string(key) || is_empty_string(value) ||
is_empty_string(name) || is_empty_string(lxcpath))
return ret_errno(EINVAL);
controller = must_copy_string(key);
p = strchr(controller, '.');
......
......@@ -3300,7 +3300,7 @@ static bool do_lxcapi_set_cgroup_item(struct lxc_container *c, const char *subsy
if (!cgroup_ops)
return false;
ret = cgroup_ops->set(cgroup_ops, subsys, value, c->name, c->config_path) == 0;
ret = cgroup_ops->set(cgroup_ops, subsys, value, c->name, c->config_path);
}
return ret == 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment