Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304942
b: refs/heads/master
c: 6edb2a8
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed May 16, 2012
1 parent f2107d4 commit b2cf0bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 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: 978da300c7a65494692b329a6a4cbf364afc37c5
refs/heads/master: 6edb2a8a385f0cdef51dae37ff23e74d76d8a6ce
24 changes: 11 additions & 13 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3875,14 +3875,14 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
struct print_entry *entry;
unsigned long irq_flags;
struct page *pages[2];
void *map_page[2];
int nr_pages = 1;
ssize_t written;
void *page1;
void *page2;
int offset;
int size;
int len;
int ret;
int i;

if (tracing_disabled)
return -EINVAL;
Expand Down Expand Up @@ -3921,9 +3921,8 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
goto out;
}

page1 = kmap_atomic(pages[0]);
if (nr_pages == 2)
page2 = kmap_atomic(pages[1]);
for (i = 0; i < nr_pages; i++)
map_page[i] = kmap_atomic(pages[i]);

local_save_flags(irq_flags);
size = sizeof(*entry) + cnt + 2; /* possible \n added */
Expand All @@ -3941,10 +3940,10 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,

if (nr_pages == 2) {
len = PAGE_SIZE - offset;
memcpy(&entry->buf, page1 + offset, len);
memcpy(&entry->buf[len], page2, cnt - len);
memcpy(&entry->buf, map_page[0] + offset, len);
memcpy(&entry->buf[len], map_page[1], cnt - len);
} else
memcpy(&entry->buf, page1 + offset, cnt);
memcpy(&entry->buf, map_page[0] + offset, cnt);

if (entry->buf[cnt - 1] != '\n') {
entry->buf[cnt] = '\n';
Expand All @@ -3959,11 +3958,10 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
*fpos += written;

out_unlock:
if (nr_pages == 2)
kunmap_atomic(page2);
kunmap_atomic(page1);
while (nr_pages > 0)
put_page(pages[--nr_pages]);
for (i = 0; i < nr_pages; i++){
kunmap_atomic(map_page[i]);
put_page(pages[i]);
}
out:
return written;
}
Expand Down

0 comments on commit b2cf0bd

Please sign in to comment.