aboutsummaryrefslogtreecommitdiffstats
path: root/fs/seq_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/seq_file.c')
-rw-r--r--fs/seq_file.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/fs/seq_file.c b/fs/seq_file.c
index ad034fb49f30..00bbe2bfc634 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -13,6 +13,7 @@
13#include <linux/cred.h> 13#include <linux/cred.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/printk.h> 15#include <linux/printk.h>
16#include <linux/string_helpers.h>
16 17
17#include <asm/uaccess.h> 18#include <asm/uaccess.h>
18#include <asm/page.h> 19#include <asm/page.h>
@@ -377,26 +378,12 @@ EXPORT_SYMBOL(seq_release);
377 */ 378 */
378void seq_escape(struct seq_file *m, const char *s, const char *esc) 379void seq_escape(struct seq_file *m, const char *s, const char *esc)
379{ 380{
380 char *end = m->buf + m->size; 381 char *buf;
381 char *p; 382 size_t size = seq_get_buf(m, &buf);
382 char c; 383 int ret;
383 384
384 for (p = m->buf + m->count; (c = *s) != '\0' && p < end; s++) { 385 ret = string_escape_str(s, buf, size, ESCAPE_OCTAL, esc);
385 if (!strchr(esc, c)) { 386 seq_commit(m, ret < size ? ret : -1);
386 *p++ = c;
387 continue;
388 }
389 if (p + 3 < end) {
390 *p++ = '\\';
391 *p++ = '0' + ((c & 0300) >> 6);
392 *p++ = '0' + ((c & 070) >> 3);
393 *p++ = '0' + (c & 07);
394 continue;
395 }
396 seq_set_overflow(m);
397 return;
398 }
399 m->count = p - m->buf;
400} 387}
401EXPORT_SYMBOL(seq_escape); 388EXPORT_SYMBOL(seq_escape);
402 389