Commit a1ad2897 authored by Li Haifeng's avatar Li Haifeng Committed by Linus Torvalds

mm/frontswap.c: fix the condition in BUG_ON

The largest index of swap device is MAX_SWAPFILES-1.  So the type should
be less than MAX_SWAPFILES.
Signed-off-by: default avatarHaifeng Li <omycle@gmail.com>
Acked-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 26086de3
...@@ -182,7 +182,7 @@ void __frontswap_init(unsigned type, unsigned long *map) ...@@ -182,7 +182,7 @@ void __frontswap_init(unsigned type, unsigned long *map)
if (frontswap_ops) if (frontswap_ops)
frontswap_ops->init(type); frontswap_ops->init(type);
else { else {
BUG_ON(type > MAX_SWAPFILES); BUG_ON(type >= MAX_SWAPFILES);
set_bit(type, need_init); set_bit(type, need_init);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment