summaryrefslogtreecommitdiffstats
path: root/drivers/of/base.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2014-06-10 18:57:00 +0200
committerRob Herring <robh@kernel.org>2014-06-16 20:31:44 +0200
commit28d3ee40ef5ad488f4ad3376d8f237b9502cecfb (patch)
treec6346191a1c86abfe2d454e9ecc0beaebb020ad4 /drivers/of/base.c
parentof/platform: Fix microblaze build failure (diff)
downloadlinux-28d3ee40ef5ad488f4ad3376d8f237b9502cecfb.tar.xz
linux-28d3ee40ef5ad488f4ad3376d8f237b9502cecfb.zip
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: Kees Cook <keescook@chromium.org> Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r--drivers/of/base.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 8368d96ae7b4..f27d922eaece 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -227,7 +227,8 @@ static int __of_node_add(struct device_node *np)
np->kobj.kset = of_kset;
if (!np->parent) {
/* 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 {
name = safe_name(&np->parent->kobj, kbasename(np->full_name));
if (!name || !name[0])