Commit 28d3ee40 authored by Kees Cook's avatar Kees Cook Committed by Rob Herring

of: avoid format string parsing in kobject names

This makes sure a format string cannot leak into the kobject name that
is constructed. (And splits the >80 character line.)
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
parent e1319ea5
...@@ -227,7 +227,8 @@ static int __of_node_add(struct device_node *np) ...@@ -227,7 +227,8 @@ static int __of_node_add(struct device_node *np)
np->kobj.kset = of_kset; np->kobj.kset = of_kset;
if (!np->parent) { if (!np->parent) {
/* Nodes without parents are new top level trees */ /* Nodes without parents are new top level trees */
rc = kobject_add(&np->kobj, NULL, safe_name(&of_kset->kobj, "base")); rc = kobject_add(&np->kobj, NULL, "%s",
safe_name(&of_kset->kobj, "base"));
} else { } else {
name = safe_name(&np->parent->kobj, kbasename(np->full_name)); name = safe_name(&np->parent->kobj, kbasename(np->full_name));
if (!name || !name[0]) if (!name || !name[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