diff options
| author | 2010-09-08 23:49:04 -0700 | |
|---|---|---|
| committer | 2010-09-08 23:49:04 -0700 | |
| commit | e199e6136ce6b151e6638ae93dca60748424d900 (patch) | |
| tree | 0d66e0b5d227c36b005e4f5537f4bbcfc6ed4904 /mm/util.c | |
| parent | KS8851: Correct RX packet allocation (diff) | |
| parent | Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 (diff) | |
| download | wireguard-linux-e199e6136ce6b151e6638ae93dca60748424d900.tar.xz wireguard-linux-e199e6136ce6b151e6638ae93dca60748424d900.zip | |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'mm/util.c')
| -rw-r--r-- | mm/util.c | 11 |
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'; |
