aboutsummaryrefslogtreecommitdiffstats
path: root/mm/swapfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r--mm/swapfile.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 78a015fcec3b..925cf795a652 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3196,7 +3196,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
3196 p->cluster_next = 1 + (prandom_u32() % p->highest_bit); 3196 p->cluster_next = 1 + (prandom_u32() % p->highest_bit);
3197 nr_cluster = DIV_ROUND_UP(maxpages, SWAPFILE_CLUSTER); 3197 nr_cluster = DIV_ROUND_UP(maxpages, SWAPFILE_CLUSTER);
3198 3198
3199 cluster_info = kvzalloc(nr_cluster * sizeof(*cluster_info), 3199 cluster_info = kvcalloc(nr_cluster, sizeof(*cluster_info),
3200 GFP_KERNEL); 3200 GFP_KERNEL);
3201 if (!cluster_info) { 3201 if (!cluster_info) {
3202 error = -ENOMEM; 3202 error = -ENOMEM;
@@ -3233,7 +3233,8 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
3233 } 3233 }
3234 /* frontswap enabled? set up bit-per-page map for frontswap */ 3234 /* frontswap enabled? set up bit-per-page map for frontswap */
3235 if (IS_ENABLED(CONFIG_FRONTSWAP)) 3235 if (IS_ENABLED(CONFIG_FRONTSWAP))
3236 frontswap_map = kvzalloc(BITS_TO_LONGS(maxpages) * sizeof(long), 3236 frontswap_map = kvcalloc(BITS_TO_LONGS(maxpages),
3237 sizeof(long),
3237 GFP_KERNEL); 3238 GFP_KERNEL);
3238 3239
3239 if (p->bdev &&(swap_flags & SWAP_FLAG_DISCARD) && swap_discardable(p)) { 3240 if (p->bdev &&(swap_flags & SWAP_FLAG_DISCARD) && swap_discardable(p)) {