Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 140856
b: refs/heads/master
c: 2dc5d12
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt committed Mar 5, 2009
1 parent c4afaf2 commit 223362b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 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: 4f3640f8a358f2183a8c966f299eeb55ca523e06
refs/heads/master: 2dc5d12b1f43134e9bc5037f69f4739cfdfab93e
14 changes: 12 additions & 2 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,21 @@ ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt)
int len;
int ret;

if (!cnt)
return 0;

if (s->len <= s->readpos)
return -EBUSY;

len = s->len - s->readpos;
if (cnt > len)
cnt = len;
ret = copy_to_user(ubuf, s->buffer + s->readpos, cnt);
if (ret)
if (ret == cnt)
return -EFAULT;

cnt -= ret;

s->readpos += len;
return cnt;
}
Expand Down Expand Up @@ -3049,6 +3054,9 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
ssize_t ret;
size_t size;

if (!count)
return 0;

/* Do we have previous read data to read? */
if (info->read < PAGE_SIZE)
goto read;
Expand All @@ -3073,8 +3081,10 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
size = count;

ret = copy_to_user(ubuf, info->spare + info->read, size);
if (ret)
if (ret == size)
return -EFAULT;
size -= ret;

*ppos += size;
info->read += size;

Expand Down

0 comments on commit 223362b

Please sign in to comment.