From: Ravindran, Madhusudhanan (M.) Date: Thu, 12 Mar 2015 17:35:52 +0000 (+0000) Subject: staging: lustre: Use kmemdup rather than duplicating its implementation X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=9cda6856e94541fb3a507d4d123e8981e560f8b2;p=deliverable%2Flinux.git staging: lustre: Use kmemdup rather than duplicating its implementation The semantic patch that makes this change is available in scriptcoccinelle/api/memdup.cocci. Signed-off-by: Madhusudhanan Ravindran Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lustre/llite/xattr_cache.c b/drivers/staging/lustre/lustre/llite/xattr_cache.c index 7e2fcfeacfa5..da190f92d140 100644 --- a/drivers/staging/lustre/lustre/llite/xattr_cache.c +++ b/drivers/staging/lustre/lustre/llite/xattr_cache.c @@ -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);