[PATCH 06/15] pseries/dlpar: use kmemdup

Nishanth Aravamudan nacc at us.ibm.com
Thu Sep 16 04:05:49 EST 2010


While looking at some code paths I came across this code that zeros
memory then copies over the entire length.

Signed-off-by: Milton Miller <miltonm at bga.com>
Signed-off-by: Nishanth Aravamudan <nacc at us.ibm.com>
---
 arch/powerpc/platforms/pseries/dlpar.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 72d8054..6004c81 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -55,13 +55,12 @@ static struct property *dlpar_parse_cc_property(struct cc_workarea *ccwa)
 
 	prop->length = ccwa->prop_length;
 	value = (char *)ccwa + ccwa->prop_offset;
-	prop->value = kzalloc(prop->length, GFP_KERNEL);
+	prop->value = kmemdup(value, prop->length, GFP_KERNEL);
 	if (!prop->value) {
 		dlpar_free_cc_property(prop);
 		return NULL;
 	}
 
-	memcpy(prop->value, value, prop->length);
 	return prop;
 }
 
-- 
1.7.0.4



More information about the Linuxppc-dev mailing list