Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 288834
b: refs/heads/master
c: 7281491
h: refs/heads/master
v: v3
  • Loading branch information
Jim Cromie authored and Greg Kroah-Hartman committed Jan 24, 2012
1 parent 613f1c8 commit b1e9e20
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8bd6026e88cb2eb1e60ee40c7a1a0786b2db6623
refs/heads/master: 7281491c594e7b8501eb5dfcf6cd3724f8a1b5b0
16 changes: 12 additions & 4 deletions trunk/lib/dynamic_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,24 +570,32 @@ __setup("ddebug_query=", ddebug_setup_query);
* File_ops->write method for <debugfs>/dynamic_debug/conrol. Gathers the
* command text from userspace, parses and executes it.
*/
#define USER_BUF_PAGE 4096
static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf,
size_t len, loff_t *offp)
{
char tmpbuf[256];
char *tmpbuf;
int ret;

if (len == 0)
return 0;
/* we don't check *offp -- multiple writes() are allowed */
if (len > sizeof(tmpbuf)-1)
if (len > USER_BUF_PAGE - 1) {
pr_warn("expected <%d bytes into control\n", USER_BUF_PAGE);
return -E2BIG;
if (copy_from_user(tmpbuf, ubuf, len))
}
tmpbuf = kmalloc(len + 1, GFP_KERNEL);
if (!tmpbuf)
return -ENOMEM;
if (copy_from_user(tmpbuf, ubuf, len)) {
kfree(tmpbuf);
return -EFAULT;
}
tmpbuf[len] = '\0';
if (verbose)
pr_info("read %d bytes from userspace\n", (int)len);

ret = ddebug_exec_query(tmpbuf);
kfree(tmpbuf);
if (ret)
return ret;

Expand Down

0 comments on commit b1e9e20

Please sign in to comment.