diff options
author | Andrzej Hajda <a.hajda@samsung.com> | 2015-08-07 09:59:25 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-08-07 15:16:58 -0700 |
commit | 741a3b0745596f18a20da30b167e46c11bb3ce53 (patch) | |
tree | 0bfcec43a4bb1cb0a3f0d2200b16bc7b3b4d10a6 /drivers/staging/lustre | |
parent | 7fb539eda2be9fce93b7f1cc933ef318e9c3771b (diff) | |
download | op-kernel-dev-741a3b0745596f18a20da30b167e46c11bb3ce53.zip op-kernel-dev-741a3b0745596f18a20da30b167e46c11bb3ce53.tar.gz |
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/2014320
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre')
-rw-r--r-- | drivers/staging/lustre/lustre/obdclass/acl.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/staging/lustre/lustre/obdclass/acl.c b/drivers/staging/lustre/lustre/obdclass/acl.c index bc3fc47..933456c 100644 --- a/drivers/staging/lustre/lustre/obdclass/acl.c +++ b/drivers/staging/lustre/lustre/obdclass/acl.c @@ -104,11 +104,10 @@ static int lustre_posix_acl_xattr_reduce_space(posix_acl_xattr_header **header, if (unlikely(old_count <= new_count)) return old_size; - new = kzalloc(new_size, GFP_NOFS); + new = kmemdup(*header, new_size, GFP_NOFS); if (unlikely(new == NULL)) return -ENOMEM; - memcpy(new, *header, new_size); kfree(*header); *header = new; return new_size; @@ -125,11 +124,10 @@ static int lustre_ext_acl_xattr_reduce_space(ext_acl_xattr_header **header, if (unlikely(old_count <= ext_count)) return 0; - new = kzalloc(ext_size, GFP_NOFS); + new = kmemdup(*header, ext_size, GFP_NOFS); if (unlikely(new == NULL)) return -ENOMEM; - memcpy(new, *header, ext_size); kfree(*header); *header = new; return 0; |