All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4] cpuset: use seq_*mask_* to print masks
@ 2008-10-12  9:29 Lai Jiangshan
  2008-10-12 17:38 ` Paul Menage
  0 siblings, 1 reply; 2+ messages in thread
From: Lai Jiangshan @ 2008-10-12  9:29 UTC (permalink / raw)
  To: Andrew Morton, Alexey Dobriyan, Paul Menage, Paul Jackson,
	Linux Kernel Mailing List


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: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index eab7bd6..684d21b 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -2437,19 +2437,15 @@ const struct file_operations proc_cpuset_operations = {
 void cpuset_task_status_allowed(struct seq_file *m, struct task_struct *task)
 {
 	seq_printf(m, "Cpus_allowed:\t");
-	m->count += cpumask_scnprintf(m->buf + m->count, m->size - m->count,
-					task->cpus_allowed);
+	seq_cpumask(m, &task->cpus_allowed);
 	seq_printf(m, "\n");
 	seq_printf(m, "Cpus_allowed_list:\t");
-	m->count += cpulist_scnprintf(m->buf + m->count, m->size - m->count,
-					task->cpus_allowed);
+	seq_cpumask_list(m, &task->cpus_allowed);
 	seq_printf(m, "\n");
 	seq_printf(m, "Mems_allowed:\t");
-	m->count += nodemask_scnprintf(m->buf + m->count, m->size - m->count,
-					task->mems_allowed);
+	seq_nodemask(m, &task->mems_allowed);
 	seq_printf(m, "\n");
 	seq_printf(m, "Mems_allowed_list:\t");
-	m->count += nodelist_scnprintf(m->buf + m->count, m->size - m->count,
-					task->mems_allowed);
+	seq_nodemask_list(m, &task->mems_allowed);
 	seq_printf(m, "\n");
 }





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 3/4] cpuset: use seq_*mask_* to print masks
  2008-10-12  9:29 [PATCH 3/4] cpuset: use seq_*mask_* to print masks Lai Jiangshan
@ 2008-10-12 17:38 ` Paul Menage
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Menage @ 2008-10-12 17:38 UTC (permalink / raw)
  To: Lai Jiangshan
  Cc: Andrew Morton, Alexey Dobriyan, Paul Jackson,
	Linux Kernel Mailing List

On Sun, Oct 12, 2008 at 2:29 AM, Lai Jiangshan <laijs@cn.fujitsu.com> wrote:
>
> 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: Lai Jiangshan <laijs@cn.fujitsu.com>

Acked-by: Paul Menage <menage@google.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-12 17:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-12  9:29 [PATCH 3/4] cpuset: use seq_*mask_* to print masks Lai Jiangshan
2008-10-12 17:38 ` Paul Menage

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.