diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2015-11-06 19:30:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-06 20:50:42 -0500 |
commit | 3a49f3d2a10dfb27411d321900197a3d6c52405b (patch) | |
tree | 0f7073139fddf2dc6d1b1166a4d87458d3836ede /fs/proc | |
parent | 1965c8b7ac7dd147663faf77a66a693ac3ddcb85 (diff) |
fs/proc/array.c: set overflow flag in case of error
For now in task_name() we ignore the return code of string_escape_str()
call. This is not good if buffer suddenly becomes not big enough. Do the
proper error handling there.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/array.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index eed2050db9be..d73291f5f0fc 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -91,18 +91,18 @@ | |||
91 | static inline void task_name(struct seq_file *m, struct task_struct *p) | 91 | static inline void task_name(struct seq_file *m, struct task_struct *p) |
92 | { | 92 | { |
93 | char *buf; | 93 | char *buf; |
94 | size_t size; | ||
94 | char tcomm[sizeof(p->comm)]; | 95 | char tcomm[sizeof(p->comm)]; |
96 | int ret; | ||
95 | 97 | ||
96 | get_task_comm(tcomm, p); | 98 | get_task_comm(tcomm, p); |
97 | 99 | ||
98 | seq_puts(m, "Name:\t"); | 100 | seq_puts(m, "Name:\t"); |
99 | buf = m->buf + m->count; | ||
100 | 101 | ||
101 | /* Ignore error for now */ | 102 | size = seq_get_buf(m, &buf); |
102 | buf += string_escape_str(tcomm, buf, m->size - m->count, | 103 | ret = string_escape_str(tcomm, buf, size, ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\"); |
103 | ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\"); | 104 | seq_commit(m, ret < size ? ret : -1); |
104 | 105 | ||
105 | m->count = buf - m->buf; | ||
106 | seq_putc(m, '\n'); | 106 | seq_putc(m, '\n'); |
107 | } | 107 | } |
108 | 108 | ||