powerpc/pseries: Use kmemdup
authorNishanth Aravamudan <nacc@us.ibm.com>
Wed, 15 Sep 2010 08:05:49 +0000 (08:05 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 13 Oct 2010 05:19:22 +0000 (16:19 +1100)
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@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/pseries/dlpar.c

index 75d336a..b74a923 100644 (file)
@@ -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;
 }