summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-13 12:34:47 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-13 12:34:47 -0800
commite6efef7260ac2bb170059980a78440499f2cc0db (patch)
tree9d2917ba865190d9be0b5204a7254ca2aea49cc1 /mm
parentb78b499a67c3f77aeb6cd0b54724bc38b141255d (diff)
parent3ca45a46f8af8c4a92dd8a08eac57787242d5021 (diff)
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')
-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;