One of the enterprise customers uses 6 TiB of swap, and the values reported in /proc/swaps as well as in dmesg are still not correct. Cast si->pages to long explicitly so that the bitshift in K() doesn't truncate the value to 32 bits. Also do the same in swapon() for the same reason. Fixes: 642929a2ded0 ("mm/swapfile: fix an integer overflow in swap_show()") Signed-off-by: Oleksandr Natalenko --- mm/swapfile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 626f3e9afc01e..3eadddc49a9d4 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3450,7 +3450,7 @@ static int swap_show(struct seq_file *swap, void *v) return 0; } - bytes = K(si->pages); + bytes = K((unsigned long)si->pages); inuse = K(swap_usage_in_pages(si)); file = si->swap_file; @@ -3959,8 +3959,8 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) /* Sets SWP_WRITEOK, resurrect the percpu ref, expose the swap device */ enable_swap_info(si); - pr_info("Adding %uk swap on %s. Priority:%d extents:%d across:%lluk %s%s%s%s\n", - K(si->pages), name->name, si->prio, nr_extents, + pr_info("Adding %luk swap on %s. Priority:%d extents:%d across:%lluk %s%s%s%s\n", + K((unsigned long)si->pages), name->name, si->prio, nr_extents, K((unsigned long long)span), (si->flags & SWP_SOLIDSTATE) ? "SS" : "", (si->flags & SWP_DISCARDABLE) ? "D" : "", -- 2.56.1