Skip to content
Commit 481ebd0d authored by Johannes Weiner's avatar Johannes Weiner Committed by Linus Torvalds
Browse files

bootmem: fix aligning of node-relative indexes and offsets



Absolute alignment requirements may never be applied to node-relative
offsets.  Andreas Herrmann spotted this flaw when a bootmem allocation on
an unaligned node was itself not aligned because the combination of an
unaligned node with an aligned offset into that node is not garuanteed to
be aligned itself.

This patch introduces two helper functions that align a node-relative
index or offset with respect to the node's starting address so that the
absolute PFN or virtual address that results from combining the two
satisfies the requested alignment.

Then all the broken ALIGN()s in alloc_bootmem_core() are replaced by these
helpers.

Signed-off-by: default avatarJohannes Weiner <hannes@saeurebad.de>
Reported-by: default avatarAndreas Herrmann <andreas.herrmann3@amd.com>
Debugged-by: default avatarAndreas Herrmann <andreas.herrmann3@amd.com>
Reviewed-by: default avatarAndreas Herrmann <andreas.herrmann3@amd.com>
Tested-by: default avatarAndreas Herrmann <andreas.herrmann3@amd.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a09f4855
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment