From: Li Haifeng Date: Wed, 10 Dec 2014 23:44:47 +0000 (-0800) Subject: mm/frontswap.c: fix the condition in BUG_ON X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a1ad28973d3d9fe23fa73fbb66fba077a987dd81;p=linux-beck.git 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 --- 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); } }