summaryrefslogtreecommitdiff
path: root/mm/util.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-08-18 15:17:30 +0200
committerTakashi Iwai <tiwai@suse.de>2010-08-18 15:17:30 +0200
commit6ab561c8aab2e4af535f09adbc6253f958536848 (patch)
tree37846adb4ea106485720d113e252d71d615c23ed /mm/util.c
parent4f4e8f69895c8696a4bcc751817d4b186023ac44 (diff)
parentcbaa9f60d5d5c3af10f94e0d49789d5b82341a4a (diff)
Merge branch 'topic/isa' into topic/misc
Diffstat (limited to 'mm/util.c')
-rw-r--r--mm/util.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/mm/util.c b/mm/util.c
index f5712e8964be..4735ea481816 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -225,15 +225,10 @@ char *strndup_user(const char __user *s, long n)
if (length > n)
return ERR_PTR(-EINVAL);
- p = kmalloc(length, GFP_KERNEL);
+ p = memdup_user(s, length);
- if (!p)
- return ERR_PTR(-ENOMEM);
-
- if (copy_from_user(p, s, length)) {
- kfree(p);
- return ERR_PTR(-EFAULT);
- }
+ if (IS_ERR(p))
+ return p;
p[length - 1] = '\0';