cgroups: improve parameter vetting

parent 7d013ccc
...@@ -2622,8 +2622,9 @@ __cgfsng_ops static int cgfsng_set(struct cgroup_ops *ops, ...@@ -2622,8 +2622,9 @@ __cgfsng_ops static int cgfsng_set(struct cgroup_ops *ops,
struct hierarchy *h; struct hierarchy *h;
int ret = -1; int ret = -1;
if (!ops || !key || !value || !name || !lxcpath) if (!ops || is_empty_string(key) || is_empty_string(value) ||
return ret_errno(ENOENT); is_empty_string(name) || is_empty_string(lxcpath))
return ret_errno(EINVAL);
controller = must_copy_string(key); controller = must_copy_string(key);
p = strchr(controller, '.'); p = strchr(controller, '.');
......
...@@ -3300,7 +3300,7 @@ static bool do_lxcapi_set_cgroup_item(struct lxc_container *c, const char *subsy ...@@ -3300,7 +3300,7 @@ static bool do_lxcapi_set_cgroup_item(struct lxc_container *c, const char *subsy
if (!cgroup_ops) if (!cgroup_ops)
return false; 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; 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