From: Andrzej Hajda Date: Fri, 7 Aug 2015 07:59:12 +0000 (+0200) Subject: powerpc/pseries: use kmemdup rather than duplicating its implementation X-Git-Tag: v4.14-rc1~4767^2~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2e16acc5ee3626bcd32e2252c8260b65efde7b36;p=platform%2Fkernel%2Flinux-rpi.git powerpc/pseries: use kmemdup rather than duplicating its implementation The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda Reviewed-by: Nathan Fontenot Signed-off-by: Michael Ellerman --- diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index 0ced387..e9ff44c 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c @@ -92,13 +92,12 @@ static struct property *dlpar_clone_drconf_property(struct device_node *dn) return NULL; new_prop->name = kstrdup(prop->name, GFP_KERNEL); - new_prop->value = kmalloc(prop->length, GFP_KERNEL); + new_prop->value = kmemdup(prop->value, prop->length, GFP_KERNEL); if (!new_prop->name || !new_prop->value) { dlpar_free_drconf_property(new_prop); return NULL; } - memcpy(new_prop->value, prop->value, prop->length); new_prop->length = prop->length; /* Convert the property to cpu endian-ness */