Commit 8d23b208 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

proc: stop using seq_get_buf in proc_task_name

Use seq_escape_str and seq_printf instead of poking holes into the
seq_file abstraction.

Link: https://lkml.kernel.org/r/20210810151945.1795567-1-hch@lst.deSigned-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3843c50a
...@@ -98,27 +98,17 @@ ...@@ -98,27 +98,17 @@
void proc_task_name(struct seq_file *m, struct task_struct *p, bool escape) void proc_task_name(struct seq_file *m, struct task_struct *p, bool escape)
{ {
char *buf;
size_t size;
char tcomm[64]; char tcomm[64];
int ret;
if (p->flags & PF_WQ_WORKER) if (p->flags & PF_WQ_WORKER)
wq_worker_comm(tcomm, sizeof(tcomm), p); wq_worker_comm(tcomm, sizeof(tcomm), p);
else else
__get_task_comm(tcomm, sizeof(tcomm), p); __get_task_comm(tcomm, sizeof(tcomm), p);
size = seq_get_buf(m, &buf); if (escape)
if (escape) { seq_escape_str(m, tcomm, ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\");
ret = string_escape_str(tcomm, buf, size, else
ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\"); seq_printf(m, "%.64s", tcomm);
if (ret >= size)
ret = -1;
} else {
ret = strscpy(buf, tcomm, size);
}
seq_commit(m, ret);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment