aboutsummaryrefslogtreecommitdiffstats
path: root/mm/frontswap.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2013-06-12 14:05:08 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-06-12 16:29:46 -0700
commit7b57976da48e60b66fdbb9e97f5711b5382a49d7 (patch)
tree4295f72436564c0bbb0521cbf486fd6907aa5e18 /mm/frontswap.c
parent736f3203a06eafd0944103775a98584082744c6b (diff)
downloadkernel_goldelico_gta04-7b57976da48e60b66fdbb9e97f5711b5382a49d7.zip
kernel_goldelico_gta04-7b57976da48e60b66fdbb9e97f5711b5382a49d7.tar.gz
kernel_goldelico_gta04-7b57976da48e60b66fdbb9e97f5711b5382a49d7.tar.bz2
frontswap: fix incorrect zeroing and allocation size for frontswap_map
The bitmap accessed by bitops must have enough size to hold the required numbers of bits rounded up to a multiple of BITS_PER_LONG. And the bitmap must not be zeroed by memset() if the number of bits cleared is not a multiple of BITS_PER_LONG. This fixes incorrect zeroing and allocation size for frontswap_map. The incorrect zeroing part doesn't cause any problem because frontswap_map is freed just after zeroing. But the wrongly calculated allocation size may cause the problem. For 32bit systems, the allocation size of frontswap_map is about twice as large as required size. For 64bit systems, the allocation size is smaller than requeired if the number of bits is not a multiple of BITS_PER_LONG. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/frontswap.c')
-rw-r--r--mm/frontswap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/frontswap.c b/mm/frontswap.c
index 538367e..1b24bdc 100644
--- a/mm/frontswap.c
+++ b/mm/frontswap.c
@@ -319,7 +319,7 @@ void __frontswap_invalidate_area(unsigned type)
return;
frontswap_ops->invalidate_area(type);
atomic_set(&sis->frontswap_pages, 0);
- memset(sis->frontswap_map, 0, sis->max / sizeof(long));
+ bitmap_zero(sis->frontswap_map, sis->max);
}
clear_bit(type, need_init);
}