Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Christoph Hellwig and committed by
Linus Torvalds
8d23b208 3843c50a

+4 -14
+4 -14
fs/proc/array.c
··· 98 98 99 99 void proc_task_name(struct seq_file *m, struct task_struct *p, bool escape) 100 100 { 101 - char *buf; 102 - size_t size; 103 101 char tcomm[64]; 104 - int ret; 105 102 106 103 if (p->flags & PF_WQ_WORKER) 107 104 wq_worker_comm(tcomm, sizeof(tcomm), p); 108 105 else 109 106 __get_task_comm(tcomm, sizeof(tcomm), p); 110 107 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); 122 112 } 123 113 124 114 /*