This patch also add checking whether alloc frontswap_map memory failed. Signed-off-by: Bob Liu <lliubbo@xxxxxxxxx> --- mm/swapfile.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index ffdd06a..8fe9e88 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2124,9 +2124,9 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) } /* frontswap enabled? set up bit-per-page map for frontswap */ if (frontswap_enabled) { - frontswap_map = vmalloc(maxpages / sizeof(long)); - if (frontswap_map) - memset(frontswap_map, 0, maxpages / sizeof(long)); + frontswap_map = vzalloc(maxpages / sizeof(long)); + if (!frontswap_map) + goto bad_swap; } if (p->bdev) { -- 1.6.3.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>