Commit 30e8e136 authored by Lai Jiangshan's avatar Lai Jiangshan Committed by Linus Torvalds

cpuset: use seq_*mask_* to print masks

1) seq_file excepts that m->count == m->size when it's buf is full,
   so current code will causes bugs when buf is overflow.

2) There is not too good that cpuset accesses struct seq_file's
   fields directly.
Signed-off-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: default avatarPaul Menage <menage@google.com>
Cc: Paul Jackson <pj@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3eda2011
...@@ -2436,19 +2436,15 @@ const struct file_operations proc_cpuset_operations = { ...@@ -2436,19 +2436,15 @@ const struct file_operations proc_cpuset_operations = {
void cpuset_task_status_allowed(struct seq_file *m, struct task_struct *task) void cpuset_task_status_allowed(struct seq_file *m, struct task_struct *task)
{ {
seq_printf(m, "Cpus_allowed:\t"); seq_printf(m, "Cpus_allowed:\t");
m->count += cpumask_scnprintf(m->buf + m->count, m->size - m->count, seq_cpumask(m, &task->cpus_allowed);
task->cpus_allowed);
seq_printf(m, "\n"); seq_printf(m, "\n");
seq_printf(m, "Cpus_allowed_list:\t"); seq_printf(m, "Cpus_allowed_list:\t");
m->count += cpulist_scnprintf(m->buf + m->count, m->size - m->count, seq_cpumask_list(m, &task->cpus_allowed);
task->cpus_allowed);
seq_printf(m, "\n"); seq_printf(m, "\n");
seq_printf(m, "Mems_allowed:\t"); seq_printf(m, "Mems_allowed:\t");
m->count += nodemask_scnprintf(m->buf + m->count, m->size - m->count, seq_nodemask(m, &task->mems_allowed);
task->mems_allowed);
seq_printf(m, "\n"); seq_printf(m, "\n");
seq_printf(m, "Mems_allowed_list:\t"); seq_printf(m, "Mems_allowed_list:\t");
m->count += nodelist_scnprintf(m->buf + m->count, m->size - m->count, seq_nodemask_list(m, &task->mems_allowed);
task->mems_allowed);
seq_printf(m, "\n"); seq_printf(m, "\n");
} }
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