diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-04-08 15:08:53 +0800 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-04-20 23:02:51 -0400 |
commit | a9482ebcdedbc5872ed34a266e6a45c35116f264 (patch) | |
tree | 2a4e82f04bce55bdd02beb39319f691ff9533fe3 /fs | |
parent | 0e639bdeef26faf287db77a15530f3f295a4ae04 (diff) | |
download | linux-a9482ebcdedbc5872ed34a266e6a45c35116f264.tar.gz linux-a9482ebcdedbc5872ed34a266e6a45c35116f264.tar.bz2 linux-a9482ebcdedbc5872ed34a266e6a45c35116f264.zip |
ncpfs: use memdup_user()
Remove open-coded memdup_user()
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ncpfs/ioctl.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index f54360f50a9c..fa038df63ac8 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c @@ -660,13 +660,10 @@ outrel: if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN) return -ENOMEM; if (user.object_name_len) { - newname = kmalloc(user.object_name_len, GFP_USER); - if (!newname) - return -ENOMEM; - if (copy_from_user(newname, user.object_name, user.object_name_len)) { - kfree(newname); - return -EFAULT; - } + newname = memdup_user(user.object_name, + user.object_name_len); + if (IS_ERR(newname)) + return PTR_ERR(newname); } else { newname = NULL; } @@ -760,13 +757,9 @@ outrel: if (user.len > NCP_PRIVATE_DATA_MAX_LEN) return -ENOMEM; if (user.len) { - new = kmalloc(user.len, GFP_USER); - if (!new) - return -ENOMEM; - if (copy_from_user(new, user.data, user.len)) { - kfree(new); - return -EFAULT; - } + new = memdup_user(user.data, user.len); + if (IS_ERR(new)) + return PTR_ERR(new); } else { new = NULL; } |