diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2016-12-09 14:13:00 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2016-12-09 14:13:00 +1100 |
commit | 5756b47c70aa2c069219cb0841ae6d6b13fca124 (patch) | |
tree | 5464b4eb470e25a252e0e5b65c0d3d813de6aae2 | |
parent | 5056933c4e381baa179c902742689b979bf8e3bb (diff) | |
parent | 3ca45a46f8af8c4a92dd8a08eac57787242d5021 (diff) |
Merge remote-tracking branch 'percpu/for-next'
-rw-r--r-- | include/linux/kernel.h | 1 | ||||
-rw-r--r-- | mm/percpu.c | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index a5d838a3cfca..56aec84237ad 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -45,6 +45,7 @@ #define REPEAT_BYTE(x) ((~0ul / 0xff) * (x)) +/* @a is a power of 2 value */ #define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) #define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask)) #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) diff --git a/mm/percpu.c b/mm/percpu.c index 255714302394..99d8abd4c1e7 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; |