]> git.hungrycats.org Git - linux/commit
[PATCH] Fix argument checking in sched_setaffinity
authorAndi Kleen <ak@muc.de>
Fri, 3 Sep 2004 03:25:53 +0000 (20:25 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 3 Sep 2004 03:25:53 +0000 (20:25 -0700)
commit973705e279f25125d89424f829fa559863cc05e7
tree4a1ae4ab1684fa808035460cabd3bd96fd62a05e
parent3f9b988c4c06ba2c08a8dfc8efe87a805c11e9c2
[PATCH] Fix argument checking in sched_setaffinity

This patch fixes the argument length checking in sched_setaffinity.

Previously it would error out when the length passed was smaller than
sizeof(cpumask_t).  And any bits beyond cpumask_s would be silently
ignored.

First this assumes that the user application knows the size of cpumask_t,
which should be kernel internal.  When you increase cpumask_t old
applications break and there is no good way for the application to find out
the cpumask_t size the kernel uses.

This patch changes it to do similar checking to the NUMA API calls:

- Any length is ok as long as all online CPUs are covered (this could
  still cause application breakage with more CPUs, but there is no good way
  around it)

- When the user passes more than cpumask_t bytes the excess bytes are
  checked to be zero.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/sched.c