[PATCHv2 01/24] sys_swapon: use vzalloc instead of vmalloc/memset

From: Cesar Eduardo Barros
Date: Sat Mar 05 2011 - 11:51:36 EST


Signed-off-by: Cesar Eduardo Barros <cesarb@xxxxxxxxxx>
Tested-by: Eric B Munson <emunson@xxxxxxxxx>
Acked-by: Eric B Munson <emunson@xxxxxxxxx>
---
mm/swapfile.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 0341c57..3fe8913 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2047,13 +2047,12 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
goto bad_swap;

/* OK, set up the swap map and apply the bad block list */
- swap_map = vmalloc(maxpages);
+ swap_map = vzalloc(maxpages);
if (!swap_map) {
error = -ENOMEM;
goto bad_swap;
}

- memset(swap_map, 0, maxpages);
nr_good_pages = maxpages - 1; /* omit header page */

for (i = 0; i < swap_header->info.nr_badpages; i++) {
--
1.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/