From a1ad28973d3d9fe23fa73fbb66fba077a987dd81 Mon Sep 17 00:00:00 2001 From: Li Haifeng Date: Wed, 10 Dec 2014 15:44:47 -0800 Subject: 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: Haifeng Li Acked-by: Konrad Rzeszutek Wilk Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/frontswap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/frontswap.c b/mm/frontswap.c index f2a3571c6e22..8d82809eb085 100644 --- a/mm/frontswap.c +++ b/mm/frontswap.c @@ -182,7 +182,7 @@ void __frontswap_init(unsigned type, unsigned long *map) if (frontswap_ops) frontswap_ops->init(type); else { - BUG_ON(type > MAX_SWAPFILES); + BUG_ON(type >= MAX_SWAPFILES); set_bit(type, need_init); } } -- cgit v1.2.3