]> git.baikalelectronics.ru Git - kernel.git/commit
[PATCH] SPARSEMEM incorrectly calculates section number
authorMike Kravetz <kravetz@us.ibm.com>
Sat, 20 May 2006 22:00:05 +0000 (15:00 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 21 May 2006 19:59:17 +0000 (12:59 -0700)
commit894f8248c9b83acec42a8826aa7142382f02fe62
treed0cec6913308fb34d539192dd0928cd0d7aae714
parent28dd3f7cc5ab60597b52071c65309923ef082e7e
[PATCH] SPARSEMEM incorrectly calculates section number

A bad calculation/loop in __section_nr() could result in incorrect section
information being put into sysfs memory entries.  This primarily impacts
memory add operations as the sysfs information is used while onlining new
memory.

Fix suggested by Dave Hansen.

Note that the bug may not be obvious from the patch.  It actually occurs in
the function's return statement:

return (root_nr * SECTIONS_PER_ROOT) + (ms - root);

In the existing code, root_nr has already been multiplied by
SECTIONS_PER_ROOT.

Signed-off-by: Mike Kravetz <kravetz@us.ibm.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/sparse.c