summaryrefslogtreecommitdiff
path: root/mm/kasan/kasan.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-16 10:06:57 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-16 10:06:57 +0300
commit956f004a044007ea3b8fb19a525535933bb4f2a4 (patch)
treea8dbe5a16d8786083bd1e3393c36133b74c30691 /mm/kasan/kasan.c
parentbfd727f3a59c3696d6fbe086589376a16a5cdf05 (diff)
parent9d3cce1e8b8561fed5f383d22a4d6949db4eadbe (diff)
downloadlinux-956f004a044007ea3b8fb19a525535933bb4f2a4.tar.xz
Merge 4.18-rc5 into staging-next
We need the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm/kasan/kasan.c')
-rw-r--r--mm/kasan/kasan.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
index f185455b3406..c3bd5209da38 100644
--- a/mm/kasan/kasan.c
+++ b/mm/kasan/kasan.c
@@ -619,12 +619,13 @@ void kasan_kfree_large(void *ptr, unsigned long ip)
int kasan_module_alloc(void *addr, size_t size)
{
void *ret;
+ size_t scaled_size;
size_t shadow_size;
unsigned long shadow_start;
shadow_start = (unsigned long)kasan_mem_to_shadow(addr);
- shadow_size = round_up(size >> KASAN_SHADOW_SCALE_SHIFT,
- PAGE_SIZE);
+ scaled_size = (size + KASAN_SHADOW_MASK) >> KASAN_SHADOW_SCALE_SHIFT;
+ shadow_size = round_up(scaled_size, PAGE_SIZE);
if (WARN_ON(!PAGE_ALIGNED(shadow_start)))
return -EINVAL;