提交 2e16acc5 编写于 作者: A Andrzej Hajda 提交者: Michael Ellerman

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/2014320Signed-off-by: NAndrzej Hajda <a.hajda@samsung.com>
Reviewed-by: NNathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 39bfd715
...@@ -92,13 +92,12 @@ static struct property *dlpar_clone_drconf_property(struct device_node *dn) ...@@ -92,13 +92,12 @@ static struct property *dlpar_clone_drconf_property(struct device_node *dn)
return NULL; return NULL;
new_prop->name = kstrdup(prop->name, GFP_KERNEL); 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) { if (!new_prop->name || !new_prop->value) {
dlpar_free_drconf_property(new_prop); dlpar_free_drconf_property(new_prop);
return NULL; return NULL;
} }
memcpy(new_prop->value, prop->value, prop->length);
new_prop->length = prop->length; new_prop->length = prop->length;
/* Convert the property to cpu endian-ness */ /* Convert the property to cpu endian-ness */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册