Commit 741a3b07 authored by Andrzej Hajda's avatar Andrzej Hajda Committed by Greg Kroah-Hartman

staging/lustre: 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: default avatarAndrzej Hajda <a.hajda@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7fb539ed
...@@ -104,11 +104,10 @@ static int lustre_posix_acl_xattr_reduce_space(posix_acl_xattr_header **header, ...@@ -104,11 +104,10 @@ static int lustre_posix_acl_xattr_reduce_space(posix_acl_xattr_header **header,
if (unlikely(old_count <= new_count)) if (unlikely(old_count <= new_count))
return old_size; return old_size;
new = kzalloc(new_size, GFP_NOFS); new = kmemdup(*header, new_size, GFP_NOFS);
if (unlikely(new == NULL)) if (unlikely(new == NULL))
return -ENOMEM; return -ENOMEM;
memcpy(new, *header, new_size);
kfree(*header); kfree(*header);
*header = new; *header = new;
return new_size; return new_size;
...@@ -125,11 +124,10 @@ static int lustre_ext_acl_xattr_reduce_space(ext_acl_xattr_header **header, ...@@ -125,11 +124,10 @@ static int lustre_ext_acl_xattr_reduce_space(ext_acl_xattr_header **header,
if (unlikely(old_count <= ext_count)) if (unlikely(old_count <= ext_count))
return 0; return 0;
new = kzalloc(ext_size, GFP_NOFS); new = kmemdup(*header, ext_size, GFP_NOFS);
if (unlikely(new == NULL)) if (unlikely(new == NULL))
return -ENOMEM; return -ENOMEM;
memcpy(new, *header, ext_size);
kfree(*header); kfree(*header);
*header = new; *header = new;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment