aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/proc/array.c34
1 files changed, 7 insertions, 27 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index bd117d065b82..a3ccf4c4ce70 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -81,6 +81,7 @@
81#include <linux/pid_namespace.h> 81#include <linux/pid_namespace.h>
82#include <linux/ptrace.h> 82#include <linux/ptrace.h>
83#include <linux/tracehook.h> 83#include <linux/tracehook.h>
84#include <linux/string_helpers.h>
84#include <linux/user_namespace.h> 85#include <linux/user_namespace.h>
85 86
86#include <asm/pgtable.h> 87#include <asm/pgtable.h>
@@ -89,39 +90,18 @@
89 90
90static inline void task_name(struct seq_file *m, struct task_struct *p) 91static inline void task_name(struct seq_file *m, struct task_struct *p)
91{ 92{
92 int i; 93 char *buf;
93 char *buf, *end;
94 char *name;
95 char tcomm[sizeof(p->comm)]; 94 char tcomm[sizeof(p->comm)];
96 95
97 get_task_comm(tcomm, p); 96 get_task_comm(tcomm, p);
98 97
99 seq_puts(m, "Name:\t"); 98 seq_puts(m, "Name:\t");
100 end = m->buf + m->size;
101 buf = m->buf + m->count; 99 buf = m->buf + m->count;
102 name = tcomm; 100
103 i = sizeof(tcomm); 101 /* Ignore error for now */
104 while (i && (buf < end)) { 102 string_escape_str(tcomm, &buf, m->size - m->count,
105 unsigned char c = *name; 103 ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\");
106 name++; 104
107 i--;
108 *buf = c;
109 if (!c)
110 break;
111 if (c == '\\') {
112 buf++;
113 if (buf < end)
114 *buf++ = c;
115 continue;
116 }
117 if (c == '\n') {
118 *buf++ = '\\';
119 if (buf < end)
120 *buf++ = 'n';
121 continue;
122 }
123 buf++;
124 }
125 m->count = buf - m->buf; 105 m->count = buf - m->buf;
126 seq_putc(m, '\n'); 106 seq_putc(m, '\n');
127} 107}