diff options
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r-- | mm/swapfile.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c index 6da4b28b896b..80f948a2028b 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -1493,7 +1493,7 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) | |||
1493 | goto bad_swap; | 1493 | goto bad_swap; |
1494 | if (swap_header->info.nr_badpages > MAX_SWAP_BADPAGES) | 1494 | if (swap_header->info.nr_badpages > MAX_SWAP_BADPAGES) |
1495 | goto bad_swap; | 1495 | goto bad_swap; |
1496 | 1496 | ||
1497 | /* OK, set up the swap map and apply the bad block list */ | 1497 | /* OK, set up the swap map and apply the bad block list */ |
1498 | if (!(p->swap_map = vmalloc(maxpages * sizeof(short)))) { | 1498 | if (!(p->swap_map = vmalloc(maxpages * sizeof(short)))) { |
1499 | error = -ENOMEM; | 1499 | error = -ENOMEM; |
@@ -1502,17 +1502,17 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) | |||
1502 | 1502 | ||
1503 | error = 0; | 1503 | error = 0; |
1504 | memset(p->swap_map, 0, maxpages * sizeof(short)); | 1504 | memset(p->swap_map, 0, maxpages * sizeof(short)); |
1505 | for (i=0; i<swap_header->info.nr_badpages; i++) { | 1505 | for (i = 0; i < swap_header->info.nr_badpages; i++) { |
1506 | int page = swap_header->info.badpages[i]; | 1506 | int page_nr = swap_header->info.badpages[i]; |
1507 | if (page <= 0 || page >= swap_header->info.last_page) | 1507 | if (page_nr <= 0 || page_nr >= swap_header->info.last_page) |
1508 | error = -EINVAL; | 1508 | error = -EINVAL; |
1509 | else | 1509 | else |
1510 | p->swap_map[page] = SWAP_MAP_BAD; | 1510 | p->swap_map[page_nr] = SWAP_MAP_BAD; |
1511 | } | 1511 | } |
1512 | nr_good_pages = swap_header->info.last_page - | 1512 | nr_good_pages = swap_header->info.last_page - |
1513 | swap_header->info.nr_badpages - | 1513 | swap_header->info.nr_badpages - |
1514 | 1 /* header page */; | 1514 | 1 /* header page */; |
1515 | if (error) | 1515 | if (error) |
1516 | goto bad_swap; | 1516 | goto bad_swap; |
1517 | } | 1517 | } |
1518 | 1518 | ||