diff options
| author | David S. Miller <davem@davemloft.net> | 2016-01-13 00:21:27 -0500 | 
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-01-13 00:21:27 -0500 | 
| commit | ddb5388ffd0ad75d07e7b78181a0b579824ba6f0 (patch) | |
| tree | be1e2bd103c69d7bbace3fffd97bc3d714bbc3d7 /lib/dynamic_debug.c | |
| parent | ccdf6ce6a8dba374668ae9b4d763e19903611c38 (diff) | |
| parent | 67990608c8b95d2b8ccc29932376ae73d5818727 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
Diffstat (limited to 'lib/dynamic_debug.c')
| -rw-r--r-- | lib/dynamic_debug.c | 11 | 
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index e3952e9c8ec0..fe42b6ec3f0c 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -657,14 +657,9 @@ static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf,  		pr_warn("expected <%d bytes into control\n", USER_BUF_PAGE);  		return -E2BIG;  	} -	tmpbuf = kmalloc(len + 1, GFP_KERNEL); -	if (!tmpbuf) -		return -ENOMEM; -	if (copy_from_user(tmpbuf, ubuf, len)) { -		kfree(tmpbuf); -		return -EFAULT; -	} -	tmpbuf[len] = '\0'; +	tmpbuf = memdup_user_nul(ubuf, len); +	if (IS_ERR(tmpbuf)) +		return PTR_ERR(tmpbuf);  	vpr_info("read %d bytes from userspace\n", (int)len);  	ret = ddebug_exec_queries(tmpbuf, NULL);  | 
