]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: lustre: Use kmemdup rather than duplicating its implementation
authorRavindran, Madhusudhanan (M.) <mravindr@visteon.com>
Thu, 12 Mar 2015 17:35:52 +0000 (17:35 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Mar 2015 09:37:57 +0000 (10:37 +0100)
The semantic patch that makes this change is available
in scriptcoccinelle/api/memdup.cocci.

Signed-off-by: Madhusudhanan Ravindran <mravindr@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/xattr_cache.c

index 7e2fcfeacfa54cf91a7c099eac8dc337e9344264..da190f92d14079fc97c7be2c188c47d8c257f4db 100644 (file)
@@ -132,11 +132,10 @@ static int ll_xattr_cache_add(struct list_head *cache,
                       xattr->xe_namelen);
                goto err_name;
        }
-       xattr->xe_value = kzalloc(xattr_val_len, GFP_NOFS);
+       xattr->xe_value = kmemdup(xattr_val, xattr_val_len, GFP_NOFS);
        if (!xattr->xe_value)
                goto err_value;
 
-       memcpy(xattr->xe_value, xattr_val, xattr_val_len);
        xattr->xe_vallen = xattr_val_len;
        list_add(&xattr->xe_list, cache);