From 9a7dd65286df3512b96d3a41bf550db8806d4cfb Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 18 Jan 2004 18:20:45 -0800 Subject: [PATCH] [PATCH] ppc64: fix a couple small OF device tree bugs which were overlooked, from Joel Schopp From: Anton Blanchard fix a couple small OF device tree bugs which were overlooked, from Joel Schopp --- arch/ppc64/kernel/proc_ppc64.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/ppc64/kernel/proc_ppc64.c b/arch/ppc64/kernel/proc_ppc64.c index 8dc8bae22fe3f..d8b70f96f539b 100644 --- a/arch/ppc64/kernel/proc_ppc64.c +++ b/arch/ppc64/kernel/proc_ppc64.c @@ -254,7 +254,7 @@ static ssize_t ofdt_write(struct file *file, const char __user *buf, size_t coun tmp++; if (!strcmp(kbuf, "add_node")) - rv = do_add_node(tmp, 1 + count - (tmp - kbuf)); + rv = do_add_node(tmp, count - (tmp - kbuf)); else if (!strcmp(kbuf, "remove_node")) rv = do_remove_node(tmp); else @@ -334,11 +334,12 @@ static struct property *new_property(const char *name, const int length, const u if (!(new->name = kmalloc(strlen(name) + 1, GFP_KERNEL))) goto cleanup; - if (!(new->value = kmalloc(length, GFP_KERNEL))) + if (!(new->value = kmalloc(length + 1, GFP_KERNEL))) goto cleanup; strcpy(new->name, name); memcpy(new->value, value, length); + *(((char *)new->value) + length) = 0; new->length = length; new->next = last; return new; -- 2.53.0