From a9285ff48f57e788957e03b41d9a877bfdb76daf Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Mon, 9 Aug 2010 17:18:26 -0700 Subject: [PATCH] --- yaml --- r: 207191 b: refs/heads/master c: 90d7404558fbe6f369d5e27b5ea3ef1e57562d3d h: refs/heads/master i: 207189: de500dfd56d85b638361495bb923ad8fb5aa41ce 207187: f8d2d697da34a021ff04836658351cf679179557 207183: f5a44bbd269e6b097aaed5241523eb015f2dc652 v: v3 --- [refs] | 2 +- trunk/mm/util.c | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 5884c348744a..7924748d9d76 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9e58143dc08123c22c5b9f782b2913bd3a07a03d +refs/heads/master: 90d7404558fbe6f369d5e27b5ea3ef1e57562d3d diff --git a/trunk/mm/util.c b/trunk/mm/util.c index f5712e8964be..4735ea481816 100644 --- a/trunk/mm/util.c +++ b/trunk/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';