Skip to content

Commit 8d23b20

Browse files
Christoph Hellwigtorvalds
authored andcommitted
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.de Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Christian Brauner <christian.brauner@ubuntu.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 3843c50 commit 8d23b20

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

‎fs/proc/array.c‎

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,27 +98,17 @@
9898

9999
void proc_task_name(struct seq_file *m, struct task_struct *p, bool escape)
100100
{
101-
char *buf;
102-
size_t size;
103101
char tcomm[64];
104-
int ret;
105102

106103
if (p->flags & PF_WQ_WORKER)
107104
wq_worker_comm(tcomm, sizeof(tcomm), p);
108105
else
109106
__get_task_comm(tcomm, sizeof(tcomm), p);
110107

111-
size = seq_get_buf(m, &buf);
112-
if (escape) {
113-
ret = string_escape_str(tcomm, buf, size,
114-
ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\");
115-
if (ret >= size)
116-
ret = -1;
117-
} else {
118-
ret = strscpy(buf, tcomm, size);
119-
}
120-
121-
seq_commit(m, ret);
108+
if (escape)
109+
seq_escape_str(m, tcomm, ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\");
110+
else
111+
seq_printf(m, "%.64s", tcomm);
122112
}
123113

124114
/*

0 commit comments

Comments
 (0)