Commit 788cf5b6 authored by Liu Shixin's avatar Liu Shixin
Browse files

mm/swap_slots: fix out-of-bounds access of percpu area

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8LKYV



--------------------------------

Variable swp_type_slots is an array with type 'struct swap_slots_cache[]'.
So raw_cpu_ptr(&swp_type_slots) is correspoinding pointer of array. Its
type is 'struct swap_slots_cache[]' rather than 'struct swap_slots_cache'.
So the offset of raw_cpu_ptr(&swp_type_slots)[swap_type] is out-of-bounds.
Use raw_cpu_ptr(&swp_type_slots[swap_type]) to get the correct variable.

Fixes: 8e41c366 ("mm: swap_slots: add per-type slot cache")
Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
parent 500c38d3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment