aboutsummaryrefslogtreecommitdiffstats
path: root/mm/swapfile.c
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2009-01-06 17:39:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 18:59:05 -0500
commit73fd8748ab0b9b3ddd178bea1d7ae03372033d96 (patch)
tree6c0173c84ff6ace213578a9a8b03fd73e23ec8ad /mm/swapfile.c
parent69beeb1d3428424fbc7546f85e5cd7ac4119c09d (diff)
swapfile: swapon needs larger size type
sys_swapon()'s swapfilesize (better renamed swapfilepages) is declared as an int, but should be an unsigned long like the maxpages it's compared against: on 64-bit (with 4kB pages) a swapfile of 2^44 bytes was rejected with "Swap area shorter than signature indicates". Signed-off-by: Hugh Dickins <hugh@veritas.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r--mm/swapfile.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 725e56c362de..e2adc8eb9317 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1461,7 +1461,7 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags)
1461 int nr_extents = 0; 1461 int nr_extents = 0;
1462 sector_t span; 1462 sector_t span;
1463 unsigned long maxpages = 1; 1463 unsigned long maxpages = 1;
1464 int swapfilesize; 1464 unsigned long swapfilepages;
1465 unsigned short *swap_map = NULL; 1465 unsigned short *swap_map = NULL;
1466 struct page *page = NULL; 1466 struct page *page = NULL;
1467 struct inode *inode = NULL; 1467 struct inode *inode = NULL;
@@ -1539,7 +1539,7 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags)
1539 goto bad_swap; 1539 goto bad_swap;
1540 } 1540 }
1541 1541
1542 swapfilesize = i_size_read(inode) >> PAGE_SHIFT; 1542 swapfilepages = i_size_read(inode) >> PAGE_SHIFT;
1543 1543
1544 /* 1544 /*
1545 * Read the swap header. 1545 * Read the swap header.
@@ -1616,7 +1616,7 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags)
1616 error = -EINVAL; 1616 error = -EINVAL;
1617 if (!maxpages) 1617 if (!maxpages)
1618 goto bad_swap; 1618 goto bad_swap;
1619 if (swapfilesize && maxpages > swapfilesize) { 1619 if (swapfilepages && maxpages > swapfilepages) {
1620 printk(KERN_WARNING 1620 printk(KERN_WARNING
1621 "Swap area shorter than signature indicates\n"); 1621 "Swap area shorter than signature indicates\n");
1622 goto bad_swap; 1622 goto bad_swap;