summaryrefslogtreecommitdiffstats
path: root/mm/percpu.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-13 21:34:47 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-13 21:34:47 +0100
commite6efef7260ac2bb170059980a78440499f2cc0db (patch)
tree9d2917ba865190d9be0b5204a7254ca2aea49cc1 /mm/percpu.c
parentMerge tag 'char-misc-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/g... (diff)
parentpercpu: ensure the requested alignment is power of two (diff)
downloadlinux-e6efef7260ac2bb170059980a78440499f2cc0db.tar.xz
linux-e6efef7260ac2bb170059980a78440499f2cc0db.zip
Merge branch 'for-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
Pull percpu update from Tejun Heo: "This includes just one patch to reject non-power-of-2 alignments and trigger warning. Interestingly, this actually caught a bug in XEN ARM64" * 'for-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: percpu: ensure the requested alignment is power of two
Diffstat (limited to 'mm/percpu.c')
-rw-r--r--mm/percpu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/percpu.c b/mm/percpu.c
index f696385bcc44..0686f566d347 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -886,7 +886,8 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved,
size = ALIGN(size, 2);
- if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align > PAGE_SIZE)) {
+ if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align > PAGE_SIZE ||
+ !is_power_of_2(align))) {
WARN(true, "illegal size (%zu) or align (%zu) for percpu allocation\n",
size, align);
return NULL;