aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 14fa52297b28..e60205722d0c 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -673,7 +673,7 @@ static int __init ftrace_dyn_table_alloc(unsigned long num_to_init)
673 673
674 cnt = num_to_init / ENTRIES_PER_PAGE; 674 cnt = num_to_init / ENTRIES_PER_PAGE;
675 pr_info("ftrace: allocating %ld entries in %d pages\n", 675 pr_info("ftrace: allocating %ld entries in %d pages\n",
676 num_to_init, cnt); 676 num_to_init, cnt + 1);
677 677
678 for (i = 0; i < cnt; i++) { 678 for (i = 0; i < cnt; i++) {
679 pg->next = (void *)get_zeroed_page(GFP_KERNEL); 679 pg->next = (void *)get_zeroed_page(GFP_KERNEL);
@@ -753,13 +753,11 @@ static void *t_start(struct seq_file *m, loff_t *pos)
753 void *p = NULL; 753 void *p = NULL;
754 loff_t l = -1; 754 loff_t l = -1;
755 755
756 if (*pos != iter->pos) { 756 if (*pos > iter->pos)
757 for (p = t_next(m, p, &l); p && l < *pos; p = t_next(m, p, &l)) 757 *pos = iter->pos;
758 ; 758
759 } else { 759 l = *pos;
760 l = *pos; 760 p = t_next(m, p, &l);
761 p = t_next(m, p, &l);
762 }
763 761
764 return p; 762 return p;
765} 763}
@@ -770,15 +768,21 @@ static void t_stop(struct seq_file *m, void *p)
770 768
771static int t_show(struct seq_file *m, void *v) 769static int t_show(struct seq_file *m, void *v)
772{ 770{
771 struct ftrace_iterator *iter = m->private;
773 struct dyn_ftrace *rec = v; 772 struct dyn_ftrace *rec = v;
774 char str[KSYM_SYMBOL_LEN]; 773 char str[KSYM_SYMBOL_LEN];
774 int ret = 0;
775 775
776 if (!rec) 776 if (!rec)
777 return 0; 777 return 0;
778 778
779 kallsyms_lookup(rec->ip, NULL, NULL, NULL, str); 779 kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
780 780
781 seq_printf(m, "%s\n", str); 781 ret = seq_printf(m, "%s\n", str);
782 if (ret < 0) {
783 iter->pos--;
784 iter->idx--;
785 }
782 786
783 return 0; 787 return 0;
784} 788}
@@ -804,7 +808,7 @@ ftrace_avail_open(struct inode *inode, struct file *file)
804 return -ENOMEM; 808 return -ENOMEM;
805 809
806 iter->pg = ftrace_pages_start; 810 iter->pg = ftrace_pages_start;
807 iter->pos = -1; 811 iter->pos = 0;
808 812
809 ret = seq_open(file, &show_ftrace_seq_ops); 813 ret = seq_open(file, &show_ftrace_seq_ops);
810 if (!ret) { 814 if (!ret) {
@@ -891,7 +895,7 @@ ftrace_regex_open(struct inode *inode, struct file *file, int enable)
891 895
892 if (file->f_mode & FMODE_READ) { 896 if (file->f_mode & FMODE_READ) {
893 iter->pg = ftrace_pages_start; 897 iter->pg = ftrace_pages_start;
894 iter->pos = -1; 898 iter->pos = 0;
895 iter->flags = enable ? FTRACE_ITER_FILTER : 899 iter->flags = enable ? FTRACE_ITER_FILTER :
896 FTRACE_ITER_NOTRACE; 900 FTRACE_ITER_NOTRACE;
897 901